Widgets should not add/remove `aria-hidden` in `display` (and maybe `contentVisibility`) hidden mode
krassowski opened this issue · 1 comments
aria-hidden
is not needed (hence should not be added) if element is hidden by standard mechanisms like display: none
. It is only needed for non-standard means (such as opacity
, scale
or translation
CSS).
MDN says:
aria-hidden="true" should not be added when:
- The HTML hidden attribute is present
- The element or the element's ancestor is hidden with display: none
- The element or the element's ancestor is hidden with visibility: hidden
The behaviour for content-visibility
is a bit more complex, see Accessibility concerns section on MDN.
We should keep DOM changes to absolute minimum as every property changed forces style recalculation, affecting performance (and the less we change the more fast paths browsers can use).
The behaviour for content-visibility is a bit more complex [...]
But that only refers to auto
; for hidden
it is the same as display: none
according to the specs:
The skipped contents must not be accessible to user-agent features, such as find-in-page, tab-order navigation, etc., nor be selectable or focusable.
Note: This is similar to giving the contents display: none.