act-rules.github.io icon indicating copy to clipboard operation
act-rules.github.io copied to clipboard

Programmatically hidden doesn't handle CSS content-visibility: and hidden=until-found

Open dd8 opened this issue 3 years ago • 1 comments

There are new ways to show/hide content:

CSS content-visibility: property

  • content-visibility: hidden removes an element's contents from the screen and a11y tree (seems easy to resolve)
  • content-visibility: auto adds elements with display: none back into a11y tree (might be harder to address)

See https://developer.mozilla.org/en-US/docs/Web/CSS/content-visibility#accessibility

Supported from Chrome/Edge 85 onwards. Not supported in Firefox/Safari

The current definition of Programmatically Hidden doesn't take content-visibility into account

Note: also affects whether an element can be focused or selected, so may impact focus definitions.

HTML hidden=until-found attribute

A new value has been added to the hidden attribute in HTML - it's no longer a boolean attribute. This makes hidden elements searchable via the browser Find command, and automatically shows then when found. This lets you search text in accordions and similar widgets.

https://github.com/WICG/display-locking/blob/main/explainers/hidden-content-explainer.md https://html.spec.whatwg.org/multipage/interaction.html#the-hidden-attribute https://developer.chrome.com/articles/hidden-until-found/

This was added to the Living Standard on 23 March 2022, and is not yet documented on MDN. Supported from Chrome 102.

How should elements with hidden=until-found be treated in rules?

dd8 avatar Jun 09 '22 13:06 dd8

🤔 Quick look through them:

  • hidden="until-found": I think we're fairly safe without it, since it should be rendered with content-visibility: hidden (same thing as hidden="true" and display: none). Additionally, hidden until found state says: "When these features attempt to scroll to a target which is in the element's subtree, the user agent will remove the hidden attribute in order to reveal the content before scrolling to it.", so we can be fairly confident that it shouldn't impact snapshots of the page in a given state (what ACT rules test).
  • content-visibility: hidden: should indeed be programmatically hidden since it seems to be dispaly: none with some special powers.
  • content-visibility: auto: from what I read on MDN, it feels like we should consider it as not programmatically hidden. The Accessibility note states that the content is still in the accessibility tree.

So, it seems we need to:

  • Add content-visibility: hidden to the list.
  • Likely add a not that hidden="until-found" triggers content-visibility: hidden the same way that hidden triggers display: none.

Jym77 avatar Jun 16 '22 13:06 Jym77