This content originally appeared on CSS-Tricks and was authored by Chris Coyier
A look from Christian Kozalla on the <dialog>
HTML element and using it to create a nice-looking and accessible modal.
I’m attracted to the <dialog>
element as it’s one of those “you get a lot for free” elements (even more so than the beloved <details>
element) and it’s so easy to get modal accessibility wrong (e.g. focus trapping) that having this sort of thing provided by a native element seems… great. ::backdrop
is especially cool.
But is it too good to be true? Solid support isn’t there yet, with Safari not picking it up. Christian mentions the polyfill from Google, which definitely helps bring basic functionality to otherwise non-supporting browsers.
The main problem is actual testing on a screen reader. Scott O’Hara has an article, “Having an open dialog,” which has been updated as recently as this very month (October 2021), in which he ultimately says, “[…] the dialog
element and its polyfill are not suitable for use in production.” I don’t doubt Scott’s testing, but because most people just roll-their-own modal experiences paying little mind to accessibility at all, I wonder if the web would be better off if more people just used <dialog>
(and the polyfill) anyway. Higher usage would likely trigger more browser attention and improvements.
The post How to Implement and Style the Dialog Element appeared first on CSS-Tricks. You can support CSS-Tricks by being an MVP Supporter.
This content originally appeared on CSS-Tricks and was authored by Chris Coyier
Chris Coyier | Sciencx (2021-10-27T20:17:48+00:00) How to Implement and Style the Dialog Element. Retrieved from https://www.scien.cx/2021/10/27/how-to-implement-and-style-the-dialog-element-2/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.