Skip to content
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]: Copying heading links gives link to preview iframe instead of main site #30410

Open
scriptcoded opened this issue Jan 29, 2025 · 1 comment
Labels

Comments

@scriptcoded
Copy link

scriptcoded commented Jan 29, 2025

Describe the bug

Copying the link of a documentation heading using the 🔗 button copies the link to the preview iframe.html URL instead of the main manager URL.

Reproduction link

https://rlmibnbglrgithub-aqgk--6006--1b4252dd.local-credentialless.webcontainer.io/?path=/docs/configure-your-project--docs

Reproduction steps

  1. Open the reproduction URL
  2. Hover over the "Do more with Storybook" heading
  3. Right click the 🔗 icon
  4. Notice that the copied URL links to the preview iframe and not the main page. When opening the link the sidebar is therefore not there.

System

Storybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^8.6.0-alpha.2 => 8.6.0-alpha.2 
    @storybook/addon-interactions: ^8.6.0-alpha.2 => 8.6.0-alpha.2 
    @storybook/addon-onboarding: ^8.6.0-alpha.2 => 8.6.0-alpha.2 
    @storybook/blocks: ^8.6.0-alpha.2 => 8.6.0-alpha.2 
    @storybook/react: ^8.6.0-alpha.2 => 8.6.0-alpha.2 
    @storybook/react-vite: ^8.6.0-alpha.2 => 8.6.0-alpha.2 
    @storybook/test: ^8.6.0-alpha.2 => 8.6.0-alpha.2 
    storybook: ^8.6.0-alpha.2 => 8.6.0-alpha.2

Additional context

I believe this would be a simple fix by checking for presence of window.parent and in that case using that URL instead of just relative linking. I'd be happy to contribute ASAP.

@scriptcoded
Copy link
Author

Could be done at the same time as #30407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants