Skip to content
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

Anchors opening <details> #3330

Open
bameyrick opened this issue Nov 16, 2018 · 2 comments
Open

Anchors opening <details> #3330

bameyrick opened this issue Nov 16, 2018 · 2 comments

Comments

@bameyrick
Copy link

Might be linking the wrong spec but I think it is this: https://www.w3.org/TR/html51/interactive-elements.html#the-details-element

I have noticed that if an anchor is placed within a closed <details> element and a user clicks on a link to that anchor, nothing happens. This might not be the intended use of the details element, but if this was a valid use case it would be good that when the user navigates to an anchor within a details element, that details element is opened.

Another potential case would be if the id to anchor to was on the details element itself and the user navigated to it then this would open the details element too (although being able to style details to be open as discussed in #2084 would potentially solve this).

An example use case for this functionality would be a feedback link in a header at the top of the page that anchors to a details element in the footer containing the feedback form, or another would be a link referencing an answer within a FAQ section using <details> and <summary> elements for the questions and answers.

@kizu
Copy link
Member

kizu commented Nov 16, 2018

I think that auto-opening details when something is targeted inside of it could be very nice.

However, I'm not so sure about opening the details when targeting themselves. I'd say that I'd be all in for summary inside details to be targetable by <label>, so you could either nest whole details inside a label, or connect them via for and id in order to get an outside toggle.

@tabatkins
Copy link
Member

Yeah, I don't think opening the details when the details itself is targeted is great. You can show the requested element already, there's no need to reveal anything!

But also: yes details' open/closed state absolutely should be CSS-controllable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants