- From: François REMY via GitHub <sysbot+gh@w3.org>
- Date: Thu, 11 Feb 2021 16:08:20 +0000
- To: public-css-archive@w3.org
I would note that letting the browser remove the attribute isn't sufficient, because if the DOM is generated via tools like React, the attribute would reappear at the next React update. So, the `onbeforematch` event is still required to support JS-driven websites (and other use cases, like rehydration of content). So, given that, I propose that the default behavior (that is, if you don't call `preventDefault`) of `onbeforematch` would be to remove the `hidden` attribute if its value allows it, and if the element is a `<details>` tag, also set its `open` attribute if it currently doesn't exist. Since the event tunnels and bubbles, that should work transparently, and authors can do something else if they would rather do. The issue of how search would function on `<details>` given its content is currently out of the tree while hidden (akin to `display: none`) should be discussed separately. Maybe we can change the behavior of `<details>` to rely on content-visibility:hidden for its content instead? Or we can provide a way to opt into this behavior, so as to not break compat. There is still one thing which I don't like, and that is the "if you fail to unhide once, you never get the event anymore" because I don't see why it's useful to punish the page in this way. If calling `onbeforematch` didn't reveal the content, you move to the next match and call it a day, I don't see why we want a persistant flag hidden to the page that disables the feature, that sounds like a footgun. I was also wondering if the website could eventually return a Promise to the event to notify when the revealing has been done, so that the browser doesn't have to rely on heuristics like "the next frame". There are already precedents for this, as described on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/ExtendableEvent/waitUntil). -- GitHub Notification of comment by FremyCompany Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5595#issuecomment-777606444 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 11 February 2021 16:08:21 UTC