prototype: responsive TOC redesign (Panel vs Drawer) - #5081
Conversation
WIP prototype for design feedback — not production-ready. Adds breakpoint TOC modes, sticky/floating toggles, and a Panel|Drawer surface switcher. Co-authored-by: Cursor <cursoragent@cursor.com>
|
added another prototype vid of panel vs drawer in the figma file since i'm having a hard time troubleshooting the pre preview build failure. |
thatblindgeye
left a comment
There was a problem hiding this comment.
Some general comments, either stuff wew should resolve in a final implementation or just stuff to look out for:
- For a non-tabbed page (components > Overview), shrinking the viewport down the ToC toggle is misaligned a bit, until I juuuuust barely scroll a teensy bit then it jumps into a more "correct" position:

- For the drawer approach, we'd just need to adjust how it's rendered a bit, right now some of the drawer gets cutoff for me
- Not sure if it's more just the example approach for the purposes of this PR or if there'd be an issue in final implementation, but when I'm at 125% zoom in Chrome, that triggers the ToC to be inside the toggle (vs a sidebar at 100% zoom), but the ToC changer in the bottom left doesnt render until I shrink my viewport down. I assume it's just a minor thing with how the changer is being rendered, but maybe something to look out for in final implementation
- With either approach, we'd need to shift focus into the ToC nav items when opening and shift focus back to the toggle button when closing (unless clicking a ToC item, then we'd want to set focus on the heading that was clicked). Right now via keyboard there's no way to actually get into the ToC at smaller viewports unless you Tab through the entire page
Personally, I think I lean slightly more towards the Popper/Dropdown approach vs the drawer. For some reason it feels a little "off" for me that the ToC would cover pretty much the entire screen when open at a certain width and lower, when the main navigation doesn't really do that. Probably a super nitpicky thing, though.
| const TOC_LG_MIN = 992; // PF lg (62rem) — toggle in sticky tabs | ||
|
|
||
| const getMenuSlot = () => | ||
| typeof document !== 'undefined' ? document.getElementById('ws-toc-menu-slot') : null; |
There was a problem hiding this comment.
Not 100% if it'll resolve the issue, but you could try updating this line to:
| typeof document !== 'undefined' ? document.getElementById('ws-toc-menu-slot') : null; | |
| typeof document !== 'undefined' ? document.getElementById?.('ws-toc-menu-slot') ?? null; |
Thanks for the feedback and comments, @thatblindgeye ! This PR is definitely not proposed code (just trying to get a somewhat close prototype of the behavior) so agree this should be fine tuned for implementation. After reviewing with the design we also decided that the popper/floating panel was the preferred approach. I shall open a follow up issue to let the experts put together the actual implementation :) |

Summary
localStorage(ws-toc-surface).Preview / review notes
Test plan
Made with Cursor