-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add Feature to expand/collapse Table of Contents #1205
Comments
The <ol>
<li>
<details>
<summary><a>1. Introduction</a></summary>
<ol>
<li><a>1.1 Module Interactions</a>
</ol>
</details>
</li>
</ol> (Leaf nodes can be left as just |
@tabatkins very cool, I had no idea and never used them before. Just tested on win VMs and... <details> is not supported in Edge 16 (nor IE 11). Seems a JS work-around may be needed if moving forward with this structure. But GitHub likes it 👻
|
I'm quite happy with this being a progressive enhancement that doesn't work in Edge yet. |
Yeah, they'll just fail-open, looking identical to how things are formatted today. That's 100% okay with me. |
Here's the first round prototyping implementation with Streams page. You'll notice differences in https://dev.anthum.com/pub/whatwg-streams-toc-details.html master...AnthumChris:toc-collapsible-details |
Whoa, there's some non-determinism going on here in Chrome - I was able to navigate one of the links once, then when I returned it refused to navigate again and just toggled it open/close. Anyway, boo on this not working in Chrome. Maybe we can add a tiny bit of JS to capture the click and dispatch properly? (However, the link is definitely clickable in my demo linked above. There's something weird going on here.) |
Originally discussed with @domenic, @tabatkins in whatwg/streams#885, this feature would add expand/collapse functionality to specific TOC lines. Pages wishing to implement this feature could add class "toc-collapsible" to the header markup. For example, the markup below would produce the expand/collapse functionality in the TOC for those headers:
collapsed:
expanded:
Which design should be used?
I created prototypes for designs and would need to know which one everyone would like to move forward with. This affects the hard-coded markup Bikeshed would add:
Where should the CSS/Javascript go?
I'm new to this project and would need to know where to put the required CSS/JS that this functionality requires. Should it be inline or in external files? I'll add inline to start and will modify as needed.
Other Requirements?
I can add this to the TOC documentation and create tests in the tests folder. Anything else needed? @tabatkins mentioned using
details
,summary
, anda11y
which I didn't understand and went over my head.And what browsers are supported/unsupported? I'll need to do CSS/JS testing on your support matrix.
Feel free to assign this to me if you'd like.
The text was updated successfully, but these errors were encountered: