Can we already use native HTML dialog element in production?

Note: This post is older than two years. It may still be totally valid, but things change and technology moves fast. Code based posts may be especially prone to changes...

(Loaded 558 times)

Are we ready to use native HTML dialogs in production? As often – it depends. Please don’t take it against me but it really depends. Some users are still forced to use older browsers, polyfills seem to be problematic, so most often we are still stucked with ARIA based dialogs. For now.

Short answer – it depends. Mostly on your user-base. If you are sure that all your users use latest browsers then I would say test and go for it. If you are not certain – maybe think it over a bit. Potentially use native dialog but supplement it with polyfill for all browsers that don’t support it yet.

I love the first rule of ARIA – don’t use ARIA. If you can use an native HTML element that can do the job well, of course. And making accessible dialogs is not easy. If you don’t believe me please check what veterans like Adrian Roselli have to say about dialogs (opens in new window). But I really love the idea of native dialog that can be used with minimal JavaScript and even supports styling quite decently.

It seems that browser support is looking good, but as mentioned not everybody can or want use the latest browsers. Adrian made me remember of my old iPad that is still working well but will never get new updates. So I am actually still using it from time to time, but with it I can’t really use the native HTML dialog as it’s Safari support is just recent.

At the same time there are still some that are forced to use Internet Explorer (IE). As much as I would want it to disappear from our analytics it seems like it is still used a bit. Just enough that we may have to think about it even today when it’s officially out of support. In these harsh times we must also think about people with older hardware and software that are maybe stucked with it. Some of them are maybe also stucked with old versions of JAWS screen-readers that works best with IE.

That’s why it depends so much – it depends on your website or web application, it depends on your user base. If you can trust your analytics (we should remember that faking user agents is a trivial task and data is not to be trusted entirely) then go and check the trends. Drill in and find if you can afford it. Or at least make the use of a polyfill that works – last time I checked GoogleChrome dialog-polyfill (opens in new window) with my latest Internet Explorer (version 11, reporting user agent as Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko) it failed colossally! I didn’t debug it but it seems that their official demo has issues with JavaScript on latest IE11. A very bad sign.

So what is my advice for now? I guess that in controlled environment, where you are sure about user-base you could go with native dialog, provided you really test it with different users. Before all that I suggest that you invest some time and read Scott’s GitHub wiki on “dialog initial focus, a proposal” (opens in new window) as well. As far as I could test it was working well, but as always – you need to verify it for yourself.

In an uncontrolled environment I would still use a verified, ARIA made pattern (or if you can verify that polyfill is working). Kitty Giraudel’s a11y-dialog (opens in new window) seems to be extendable enough and what is also important – tested enough. But you would still be wise to re-test it when implemented in your solution.

So conclusion for the most of us is that it’s too early now. Although “don’t use ARIA if there is a native HTML element” is the golden rule we are still stucked, at least most of us, with using ARIA instead of native. For now.

Author: Bogdan Cerovac

I am IAAP certified Web Accessibility Specialist (from 2020) and was Google certified Mobile Web Specialist.

Work as digital agency co-owner web developer and accessibility lead.

Sole entrepreneur behind IDEA-lab Cerovac (Inclusion, Diversity, Equity and Accessibility lab) after work. Check out my Accessibility Services if you want me to help your with digital accessibility.

Also head of the expert council at Institute for Digital Accessibility A11Y.si (in Slovenian).

Living and working in Norway (🇳🇴), originally from Slovenia (🇸🇮), loves exploring the globe (🌐).

Nurturing the web from 1999, this blog from 2019.

More about me and how to contact me: