Skip to content

Conversation

@pan-kot
Copy link
Member

@pan-kot pan-kot commented Nov 4, 2025

Description

Rel: [AWSUI-61421]

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.

@pan-kot pan-kot force-pushed the fix-chart-popover-in-iframe branch from 17b9e1c to db0ca4e Compare November 4, 2025 09:12

const popoverRef = useMergeRefs(popoverObjectRef, ref);

const clickFrameId = useRef<number | null>(null);
Copy link
Member Author

Choose a reason for hiding this comment

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

We use the same implementation in the internal popover component. The chart popover cannot use it because it imports the popover container instead.

) {
// Dismiss popover unless there was a click inside within the last animation frame.
// Ignore clicks inside the chart as those are handled separately.
if (clickFrameId.current === null && !nodeContains(container, event.target as Element)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The !nodeContains(container, event.target as Element) is a check that is chart-popover specific, and is taken from the prev. implementation - not from the internal popover. Its purpose is to prevent dismiss action in case the click is done within the chart's SVG so that the chart itself can define the appropriate popover behaviour in that case.

const blurTarget = event.relatedTarget || event.target;
if (
blurTarget === null ||
!(blurTarget instanceof Element) ||
Copy link
Member Author

Choose a reason for hiding this comment

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

The blurTarget instanceof Element fails if the target belongs to a different document. As result, this if condition always resolves to true and thus causes the popover to be dismissed unexpectedly.

See:

Screen.Recording.2025-11-04.at.10.18.49.mov

Replacing the check with !isElement(blurTarget) fixes the problem.

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.25%. Comparing base (4550381) to head (71e792d).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4005      +/-   ##
==========================================
+ Coverage   97.20%   97.25%   +0.05%     
==========================================
  Files         858      859       +1     
  Lines       25362    25390      +28     
  Branches     9016     9046      +30     
==========================================
+ Hits        24652    24693      +41     
+ Misses        704      691      -13     
  Partials        6        6              

☔ 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.

@pan-kot pan-kot force-pushed the fix-chart-popover-in-iframe branch from db0ca4e to b3c960f Compare November 4, 2025 10:12
@pan-kot pan-kot marked this pull request as ready for review November 4, 2025 10:27
@pan-kot pan-kot requested a review from a team as a code owner November 4, 2025 10:27
@pan-kot pan-kot requested review from gethinwebster and removed request for a team November 4, 2025 10:27
gethinwebster
gethinwebster previously approved these changes Nov 4, 2025
gethinwebster
gethinwebster previously approved these changes Nov 4, 2025

// Pins popover on the first point.
await page.click('h2');
await page.keys(['Tab', 'ArrowRight', 'Enter']);
Copy link
Member Author

Choose a reason for hiding this comment

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

@gethinwebster I changed popover activation from pointer to keyboard because the former approach did not work with React 16 test pages: the page.hoverElement() did not help with offsetting the click. I did test the feature manually on both React versions.

@pan-kot pan-kot added this pull request to the merge queue Nov 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 4, 2025
@pan-kot pan-kot added this pull request to the merge queue Nov 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 4, 2025
@pan-kot pan-kot added this pull request to the merge queue Nov 4, 2025
Merged via the queue into main with commit 58547d1 Nov 4, 2025
49 checks passed
@pan-kot pan-kot deleted the fix-chart-popover-in-iframe branch November 4, 2025 17:48
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