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
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exporter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"organization": "Supernova",
"source_dir": "src",
"assets_dir": "assets",
"version": "4.11.2",
"version": "4.11.3",
"usesBrands": false,
"config": {
"sources": "sources.json",
Expand Down
23 changes: 16 additions & 7 deletions src/page_body/structure/blocks/page_block_embed_storybook.pr
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@
<div class="content-block content-block--embed">
<div class="storybook-container" style="height: {{ (block.size && block.size.height) ? block.size.height : 500 }}px">
<div class="storybook-embed-container">
{* Iframe in iframe was used to prevent controlling scroll of parent window from iframe. *}
{* This is a hack bacause it's a Chrome bug exploit and can become broken in some time *}
{* More info: https://stackoverflow.com/a/71434176 *}
<iframe
class="embed-responsive-item storybook"
src="{{ block.url }}"
allowfullscreen
loading="lazy"
aria-label="Embedded Storybook"
referrerpolicy="origin"
class="embed-responsive-item"
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

class='embed-responsive-item storybook'
src='{{ block.url }}'
allowfullscreen
loading='lazy'
aria-label='Embedded Storybook'
referrerpolicy='origin'
style='position: fixed; top: 0; width: 100vw; height: 100vh; border: none; padding: 0; margin: 0; '
></iframe>
">
</iframe>
</div>
<div class="storybook-error">
<span>{{ storybookError ? storybookError : "Storybook failed to load. Please connect to the VPN to access." }}</span>
Expand Down