Re: [csswg-drafts] [css-contain-2] Proposal: content-visibility: hidden-matchable (#5595)

A few of us (@smfr, @emilio, @fantasai, @fremycompany, @frivoal) got together to try and think a way out of the current apparent deadlock. Here's what we came up with.

Goals:
* Build primitives for making `<details>` work
* Make it so that it can work without JS
    
Design: UA does the reveal, sets an attribute so page can respond without JS, fires event to allow page to adapt if more than that is necessary.

Proposal: Add new value to 'hidden' attribute (e.g. `hidden=until-found`) to represent hidden-matchable state, remove attribute when UA wants to reveal the content. It does not on its own hide the content; that's achieved by matching this attribute through selectors and applying display:none or content-visibility:hidden, as appropriate. (Default to ??? in the UA stylesheet.) It does mean though, that the content remains searchable even if it’s hidden away using something that would otherwise make it not searchable. Match triggers if element or content within is targeted (e.g. using find, using scrollToElement or .focus(), using fragID). In the case of search, only trigger on "find next", not merely when finding all the matches so that e.g. Wikipedia doesn't reveal all sections as soon as you type 's' into the search box.

Note: In WebKit, find normally requires layout, though a specialized path finding probable matches could conceivably be built.

ISSUE: Should sequential navigation ("go to next heading", tab navigation) trigger a match? Seems to depend on the use case.

P.S. We should also fire an event when beginning a search so the page can can update DOM with suspended content, but this is a separate issue.

-- 
GitHub Notification of comment by fantasai
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5595#issuecomment-776914538 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 10 February 2021 18:23:02 UTC