-
-
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
Changing stories should reset iframe scroll position to top #5598
Comments
This has something to do with emotion. I don't quite know the mechanism, but it can be reproduced pretty easily with the following story:
Try opening the story in its own iframe and commenting the (notice how "foobar" is scrolled into view for no apparent reason) |
Any ideas @ndelangen? |
Not an emotion thing, AFAIT: There's no difference in behavior between these: import React from 'react';
import { styled } from '@storybook/theming';
const Div = styled.div({});
export default {
title: 'Core|Scroll',
decorators: [
fn => (
<div>
<div style={{ height: '100vh' }} />
<div>{fn()}</div>
</div>
),
],
};
export const story1 = () => <pre>story 1</pre>;
story1.title = 'story with 100vh padding 1';
export const story2 = () => <pre>story 2</pre>;
story2.title = 'story with 100vh padding 2'; import React from 'react';
import { styled } from '@storybook/theming';
const Div = styled.div({});
export default {
title: 'Core|Scroll',
decorators: [
fn => (
<div>
<div style={{ height: '100vh' }} />
<Div>{fn()}</Div>
</div>
),
],
};
export const story1 = () => <pre>story 1</pre>;
story1.title = 'story with 100vh padding 1';
export const story2 = () => <pre>story 2</pre>;
story2.title = 'story with 100vh padding 2'; |
Can confirm it's in firefox too, not some random browser bug |
w00t!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.0-rc.5 containing PR #5713 that references this issue. Upgrade today to try it out! Because it's a pre-release you can find it on the |
I'm afraid the exact behavior described in domyenis' first comment is still happening in version 6.5.6 |
latest 6.5.13 still has the same |
This behavior is still presents on V7 too. |
Describe the bug
When a user changes stories the iframe scroll position is not reset. If you scroll halfway down a page and change the story you will still be at the same scroll position in the new story.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The scroll position should reset to top every time you change a story
Screenshots
An lossy Gif:
The text was updated successfully, but these errors were encountered: