Are native browser modals like window.confirm
, window.alert
, and window.prompt
accessible, or is it better to implement something custom?
Note. A confirm box is often used if you want the user to verify or accept something. A confirm box takes the focus away from the current window, and forces the user to read the message. Do not overuse this method.
window. confirm() instructs the browser to display a dialog with an optional message, and to wait until the user either confirms or cancels the dialog.
Javascript | Window confirm() Method It prevents the user from accessing other parts of the page until the box is closed. message is the optional string to be displayed in the dialog. It returns a boolean value indicating whether OK or Cancel was selected (true means OK and false means that the user clicked cancel).
Although JavaScript pop-up alert boxes were once discouraged by accessibility experts, modern screen readers and browsers provide excellent support for the basic JavaScript alert box.
There isn't a whole lot of info out there on this, but I believe the answer is yes (for the most part). It seems that previously screen readers didn't have support for alerts/window dialogs but screen readers have come to support these in today's world.
"Although JavaScript pop-up alert boxes were once discouraged by accessibility experts, modern screen readers and browsers provide excellent support for the basic JavaScript alert box."
http://accessibility.psu.edu/scripts/alertboxes/#basic
https://www.w3.org/TR/2018/WD-wai-aria-practices-1.2-20180719/examples/dialog-modal/alertdialog.html
Reading through the w3 documentation, it seems as though it's more preferred to make your own and specify the appropriate aria
attributes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With