-
-
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
header links navigates to unknown page #16918
Comments
I'm also seeing this in the latest version 6.4.0. Thanks for flagging the bug 👍 You can also see it live here by clicking the headings in the docs page - https://storybookjs.netlify.app/official-storybook/?path=/story/addons-docs-markdown-docs--page |
I'm not sure whats the correct fix for this (should we test against SVG elements as well?) nor what could be a valid workaround until this is fixed. Maybe @shilman can advise? |
Hi @shilman Do you know if this is being worked on |
Not yet. Please feel free to take a crack at it if it's blocking you! |
OK I think i found the issue and a way to fix it. I'm not sure how good is this fix though. It turns out that in mdx.tsx we are emitting Because we are passing My suggested solution is to bring back
I'm not sure this is the best solution or naming but anyway it seems to work fine. @shilman @ndelangen WDYT? PR - #17080 |
Jiminy cricket!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.9 containing PR #17134 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
I've updated to prerelease. <NavBanner and in the same file I've used anchor link In result links in component do not work but test anchor link works. https://www.screencast.com/t/JStshkoy |
w00t!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.10 containing PR #17134 that references this issue. Upgrade today to the
|
Thank you for your comment but issue is still there after update to 6.4.10 so anchor links in mdx file works, but if I use custom component with such links in mdx file those links won't work. |
@StanislavPonomarenko we don't support links from custom components. please open a separate issue. |
After migrating from storybook v5 to v6 i have noticed a strange behavior regarding auto generated header links. After a quick search i found out why it is happening (but not sure how it worked until now with previous version).
Given this check in
addons-links
and the fact that all header anchors are actually an SVG elements, this check always evaluates totrue
(SVG element != HTML Element).Because we
return
we are not triggering thepreventDefault
method of the event hence the link navigates to a different page (a none existing page).Here is a screenshot of the gist of it
To Reproduce
I just created a fresh repo with
npx sb@next repro
and this bug shows up, i didn't change anything.System
Environment Info:
System:
OS: macOS 11.6
Binaries:
Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
Yarn: 1.22.5 - ~/.y/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
Browsers:
Chrome: 96.0.4664.55
Firefox: 85.0.2
Safari: 15.0
The text was updated successfully, but these errors were encountered: