Skip to content

fix: Position drag UAPs correctly on same-origin iframes sharing a React tree #3502

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

avinashbot
Copy link
Member

@avinashbot avinashbot commented May 13, 2025

Description

Crazy what you can do with an iframe these days. Rather than trying to do anything complex with calculating parent iframes and offsets, I just decided to put the portal in the closest iframe so all the rest of the assumptions work out.

Related links, issue #, if available: AWSUI-60742

How has this been tested?

Screenshot tests are probably the best way to handle this. Since the feature has already made it through, I'll add the screenshot tests first, and then merge this.

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.

Copy link

codecov bot commented May 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.50%. Comparing base (cc179df) to head (62ba395).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3502    +/-   ##
========================================
  Coverage   96.50%   96.50%            
========================================
  Files         804      804            
  Lines       23136    23143     +7     
  Branches     7949     7594   -355     
========================================
+ Hits        22327    22334     +7     
- Misses        755      802    +47     
+ Partials       54        7    -47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -21,6 +21,16 @@ export default function PortalOverlay({
children: React.ReactNode;
}) {
const ref = useRef<HTMLSpanElement | null>(null);
const [container, setContainer] = useState<HTMLDivElement | null>(null);

useLayoutEffect(() => {
Copy link
Member Author

Choose a reason for hiding this comment

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

useLayoutEffect and useState to preempt whatever the portal component is doing, so that it doesn't make its own container for nothing.

@avinashbot avinashbot marked this pull request as ready for review May 14, 2025 11:41
@avinashbot avinashbot requested a review from a team as a code owner May 14, 2025 11:41
@avinashbot avinashbot requested review from abdhalees and removed request for a team May 14, 2025 11:41
@avinashbot avinashbot added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@avinashbot avinashbot force-pushed the drag-handle-iframe branch from 62ba395 to f852d78 Compare May 15, 2025 11:29
@avinashbot avinashbot enabled auto-merge May 15, 2025 11:29
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