w3c / html-aria

ARIA in HTML
https://w3c.github.io/html-aria/
Other
181 stars 48 forks source link

Using ARIA despite implicit HTML semantics #254

Closed JAWS-test closed 3 years ago

JAWS-test commented 3 years ago

https://www.w3.org/TR/html-aria/#rules-wd:

Web developers MAY use the ARIA role ... , except where these ... are equal to the implicit ARIA semantics of a given HTML element.

It is NOT RECOMMENDED for web developers to set the ARIA role and aria-* attributes to values that match the implicit ARIA semantics defined in the table

Perhaps the rules, which are correct in themselves, could be accompanied by a note that it is sometimes very useful to repeat the implicit role per ARIA, e.g., for

masi commented 3 years ago

And allow aria-hidden together with hidden. The latter will a) be overriden by CSS and b) may be changed with JavaScript.

scottaohara commented 3 years ago

@JAWS-test section two has the note

While setting an ARIA role and/or aria-* attribute that matches the implicit ARIA semantics is NOT RECOMMENDED, in some situations explicitly setting these attributes can be helpful. For instance, in user agents which lack specific implicit semantics.

So the spec already acknowledges that there are instances where a not recommended approach may be necessary. Yes, it will produce a validation error, but a few validation errors should be of little consequence if there are no detrimental impacts on the end user.

There have been discussions on more explicitly stating what you suggest, and the worry there being that it gives browsers / AT a loophole to validate their bugs or undocumented/non-standard heuristics. e.g., "we don't have to fix this, just use ARIA to fix it yourself"

masi commented 3 years ago

Lot's of warnings are an issue in the age of automated tests. I don't understand why a few wasted bytes are such an issue for you that you want to make a validation report looking more bad that it actually is.