Skip to content

chore: Adds iframe helper and iframe vr test #61

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

Merged
merged 2 commits into from
Jul 17, 2025
Merged

chore: Adds iframe helper and iframe vr test #61

merged 2 commits into from
Jul 17, 2025

Conversation

pan-kot
Copy link
Member

@pan-kot pan-kot commented Jul 15, 2025

Description

Rel: [ZaftArmITulj]

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

if (!container) {
return;
}
const iframeEl = container.ownerDocument.createElement("iframe");
Copy link
Member

Choose a reason for hiding this comment

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

Could the iframe be part of the returned component JSX instead? (even if we then imperatively modify its content, maybe we can at least avoid imperatively creating it)

Copy link
Member Author

Choose a reason for hiding this comment

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

This should work. The original code was copied from here: https://github.com/cloudscape-design/components/blob/main/pages/utils/iframe-wrapper.tsx#L39, but I think we can make an improvement and then decide on which approach is better if creating a reusable util in the toolkit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Interestingly, the code that creates and removes iframe was deliberate: cloudscape-design/components#2499

However, I checked the current version and it does work in Firefox.


const innerAppRoot = iframeDocument.createElement("div");
iframeDocument.body.appendChild(innerAppRoot);
copyStyles(document, iframeDocument);
Copy link
Member

Choose a reason for hiding this comment

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

Do we expect our consumers to copy their styles in a similar way?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, but the iframe should have all necessary styles bundled.

@pan-kot pan-kot added this pull request to the merge queue Jul 17, 2025
Merged via the queue into main with commit 094f03b Jul 17, 2025
39 of 41 checks passed
@pan-kot pan-kot deleted the iframe-helper branch July 17, 2025 08:21
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