-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: open <details> when the user navigates to an ID inside it #4051
Comments
I think this is probably a good idea. I wonder if we can reuse the event (or perhaps the whole concept??) from searchable invisible DOM, since the issue is not only anchor links, but also tab navigation, find in page, etc. /cc @rakina |
Hmm |
Anchors in the shadow tree don't work, but light-tree anchors that get slotted still should, right? |
Oh yeah you're right. Nevermind the comment on shadow things then. This should work, but I don't know whether it's better to have these things as an event so that authors should toggle when necessary or just let the UA do it automatically. |
This would be especially helpful for the use-case where each |
We should also open these elements when find-in-page or scroll-to-text fragments target an element within the |
It's hard to imagine what compat problems would arise, since it's hard to write a test that depends on find-in-page or scroll-to-fragment or scroll-to-text-fragment. It's technically doable, using Also, since the user can open/close the So, I'm optimistic for this change. |
I think the compat problems, if they occur, would be that developers may not like the behavior and not want it to auto-open. If that is true (and I really have no direct data on it either way), we could solve it with an opt-out attribute. Thinking more, seems good to have the opt-out and ship it by default. Always good to have DOM content be accessible to the UA algorithms by default. |
Any ideas on what this opt-out should look like? I think an attribute would make sense. Does anyone have any other ideas or a name for the attribute? How about |
I'd like to know more what motivates an opt-out. In part this seems a UA UI decision and in part I worry that users would be confused why some of these end up opening and others not. |
After thinking about it more, I agree that there shouldn't be an opt out. |
I opened a PR for this feature: #6466 |
Closes whatwg#4051. This also changes the rendering model of hidden <details> content to use content-visibility: none instead of being "removed from the rendering".
Can we make details open automatically when a user navigates to an ID inside it?
Consider the following code on a page https://example.org/:
On another page there’s a link that points to https://example.org/#family. Currently, that link won’t lead a user who clicks on the link to the paragraph with the
id="family"
, although that would be helpful and I can’t imagine – from an author’s or user’s perspective – why it should not.The text was updated successfully, but these errors were encountered: