-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Browser does not scroll to an item hidden in a collapsed details HTML element #7165
Comments
Hi, you can put the following into something like <details>
<summary>Content inside</summary>
<h2 id="heading">A heading</h2>
</details> And navigate to The same happens for tabs. See #5343 In general, an element doesn't know precisely what's inside it as that would be a very costly and hacky check (a tree traversal that's potentially very deep), so the details element won't know that (a) the page is now focused to an anchor (b) that anchor represents an element (c) that element is contained within me. There simply isn't enough information for it to make that decision. If you think that UX is important, you can swizzle Note that having headings within details itself is bad web design. You should NOT have structural content within collapsible/hideable areas as that could confuse people using visual aid tools. Only put supplementary, brief text within details, but not full sections. |
@Josh-Cena do you have a source for this recommendation? It makes sense but I haven't seen it stated elsewhere. Other accessibility/docs sites might need to be updated. |
I can't remember where I read it, sorry🤦♂️ It's also complicated because certain hideable elements (e.g. |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Clicking an item from the TOC on the right does not scroll down to the section if the selected item is in a collapsed details HTML element.
It works expected when the details section is expanded.
Reproducible demo
https://codesandbox.io/s/runtime-wood-96c61u?file=/docs/issue.md
Steps to reproduce
Expected behavior
Once the item from the TOC is clicked, the
details
section will expand automatically and browser will scroll to the header.Actual behavior
Browser does not scroll to the item selected.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: