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

RCT-2097: Storybook scroll fix #132

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

windok
Copy link
Contributor

@windok windok commented Apr 24, 2024

The issue happens because automatic scroll in iframe that controls parent window. Seems that iframe with storybook includes Element: scrollIntoView() invocation that can lead to issue.
To reproduce the issue I have found public Storybook example that scrolls content on document load: https://main--626696a2018c1f004a1cde86.chromatic.com/?path=/docs/components-collections-menu--docs.

There is open draft to W3C that aims to cover this behaviour but for now there is no browser agnostic solution.

I have used this fix for Chrome browsers that uses another Chrome bug, so it's not clear how long this fix will work until that second bug will be resolved.

@windok windok requested a review from honzatmn April 24, 2024 19:36
@windok windok self-assigned this Apr 24, 2024
@windok windok requested a review from artufimtcev April 24, 2024 19:37
@windok windok force-pushed the yevhenii/RCT-2097-iframe-scroll branch 2 times, most recently from 5bbd93a to 43d7960 Compare April 25, 2024 11:04
@windok windok force-pushed the yevhenii/RCT-2097-iframe-scroll branch from 43d7960 to 6569534 Compare April 25, 2024 11:05
Copy link
Contributor

@honzatmn honzatmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, only left one comment with question because this pattern seems wild to me 😅

style="height: {{ (block.size && block.size.height && block.size.height < 150) ? block.size.height + "px" : "100%" }}"
></iframe>
srcdoc="
<iframe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a completely new pattern to me, so I'm not able to say if it's okay or not okay to have it like this.

How confident are you that it works for all what our Storybook block supports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar issue is present on FE for cloud. So, FE team will take a look on possible solutions as well and then we are going to make the same solution for doc exporter as well.

https://linear.app/supernova-io/issue/RCT-2097/ex-docs-bug-or-preview-published-doc-when-clicking-on-the-tab-it#comment-8e5ea6a1

@windok windok marked this pull request as draft May 23, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants