-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Bug]: docs-mode table-of-contents does not change URL when clicking on an anchor #26345
Comments
@kroeder in the repro you provided, the TOC does link to the # anchor. Can you clarify how do you expect it to work differently? |
@vanessayuenn yes, it links to the anchor correctly, but clicking it doesn't change the browser URL |
I have confirmed the behavior @kroeder described: When hovering over the anchor tag, as shown in the image below, it behaves as expected. However, upon clicking, the browser URL does not update to reflect the clicked anchor tag. @vanessayuenn Can I give it a try? Thanks. |
@sooster910 of course! We'd be thrilled to have your contribution. If this is your first contribution, be sure to check the contribution guide and hop onto the Storybook Discord if you need any help getting started. Looking forward to your PR! ✨ |
Bug - When toc:true is enabled, docs-mode renders a table-of-contents inside the docs page. Clicking a toc list-item does not change the URL. Solution - Add a function so that the URL changes when clicking on a toc list-item.
Just came across this issue in a repo I'm working with. @sooster910 can you update your PR to no conflicts? |
@emlynmac Sure. Given the conflicts with the original PR, I'll go ahead and create a new PR to address the issue from scratch. @vanessayuenn once the new PR is up, I would appreciate it if you could review it. Thanks. |
This could be related #29361 If you have an anchor hash value,
@sooster910 by any chance, did your PR fix problem 2? If not, that's fine! I'm currently investigating #29361 myself |
@kroeder hi, the scrolling only works when you click the TOC now - the click handler updates the anchor, but if you type the anchor directly in the address bar, it doesn't work. Let me know if you need any clarification! |
Describe the bug
If you enable
toc: true
, docs-mode renders a table-of-contents inside the docs page.When clicking on one of the toc list-items, the expected behavior would be to add the # anchor to the browser URL.
It should behave the same as clicking the # icon on a docs-page headline.
To Reproduce
https://stackblitz.com/edit/github-w91kck?file=.storybook%2Fpreview.ts
System
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: