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

Link to external site would navigate preview iframe with no way to reset #1122

Closed
danielduan opened this issue May 24, 2017 · 3 comments
Closed
Labels

Comments

@danielduan
Copy link
Member

For a story that has a link to an external site, if the user clicks and navigates to the site, there's no way to return the preview iframe back except to refresh the page.

Story:

<a href="https://www.google.com">Click here to be banished forever!</a>
or 
<a href="/somewhere/far/far/away">Click here to get lost!</a>

Discovered this bug while playing with Lonely Planet's Storybook:
https://github.com/lonelyplanet/backpack-ui

I think we can fix it by detecting the location of the iframe when navigating to a new story and reload the entire iframe if it's in the wrong place.

@blairanderson
Copy link
Contributor

I am having this problem as well.

@ndelangen
Copy link
Member

#7 (comment)

I don't think we should touch this behavior tbh. It's the web. You made an <a> without a target.. This is what happens.

But having said that.. You could easily wrap a decorator or addon to preventDefault() that.

blairanderson added a commit to blairanderson/storybook that referenced this issue Aug 13, 2017
I found that creating normal `<a target="_blank" href="https://www.google.com">foo</a>` links inside of a story would update the iframe and not actually take the user out to the external link

`<base>`tag is supported by all browsers https://stackoverflow.com/a/2656798/1536309 

fixes storybookjs#1122
@Hypnosphi
Copy link
Member

#1650 solves this while respecting usual browser behaviour

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

5 participants