Weighing the Native <dialog> Element Against Its Accessibility Gaps
Christian Kozalla has published a walkthrough of the HTML <dialog> element, showing how it can be used to build an attractive and accessible modal. Writing at CSS-Tricks, the site's Chris Coyier singles out <dialog> as one of those elements that hands developers a great deal for free — even more so than <details> — and notes how easy it is to get modal accessibility wrong, focus trapping being the obvious example.
The ::backdrop pseudo-element gets a particular mention as a welcome bonus. But Coyier asks whether the element is too good to be true: browser support is not yet solid, and Safari has not picked it up. Kozalla points to Google's polyfill, which restores basic functionality in browsers that lack native support.
The bigger obstacle is screen reader testing. Scott O'Hara's article "Having an open dialog", updated as recently as October 2021, concludes that "the dialog element and its polyfill are not suitable for use in production." Coyier accepts that testing, yet raises a counterpoint: since most developers build modal experiences from scratch with little regard for accessibility, the web might be better served if more of them used <dialog> and the polyfill regardless. Greater adoption, he reasons, would likely draw more browser attention and lead to improvements.



