Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is window.confirm() accessible?

Are native browser modals like window.confirm, window.alert, and window.prompt accessible, or is it better to implement something custom?

like image 558
iamdtang Avatar asked Apr 09 '19 00:04

iamdtang


People also ask

Should you use window confirm?

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.

How does window confirm work?

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.

What is the importance of window confirm () method?

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).

Are JavaScript alerts accessible?

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.


1 Answers

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

like image 62
mwilson Avatar answered Sep 21 '22 19:09

mwilson