material-web icon indicating copy to clipboard operation
material-web copied to clipboard

Dialogs should not assume to be alerts

Open steverep opened this issue 3 years ago • 1 comments

the mwc-dialog component currently hard codes:

  • role="alertdialog"
  • aria-describedby="content"

This only makes sense for dialogs that meet the extra qualifications for an ARIA alert, but most dialogs do not and the component is much more versatile than that.

I recommend making the following changes:

  1. Give the implementer the choice between roles dialog or alertdialog, and the default should be dialog to be least intrusive to assistive technology
  2. Set aria-describedby to all contents only when the role is alertdialog as the contents can be assumed to be concise
  3. For the dialog role, give the implementer some control over aria-describedby, and omit it by default to be least disruptive to assistive technology

steverep avatar Feb 02 '22 19:02 steverep

We need to update the default role to dialog, thanks for capturing this!

asyncliz avatar Feb 11 '22 20:02 asyncliz

Fixed in M3, dialog's are dialog role by default and can be set to an alertdialog with the type="alert" attribute

asyncliz avatar Aug 23 '23 01:08 asyncliz