From 816e8049b6429e5c91353323921a944fcf567403 Mon Sep 17 00:00:00 2001 From: Nathnael Dereje Date: Tue, 28 Apr 2026 18:28:47 +0200 Subject: [PATCH] fix: Listen to owner window on scroll, add more tests. --- pages/annotation-context/with-iframe.page.tsx | 45 ++++++++++++++++ .../disabled-reason-iframe.page.tsx | 17 ++++++ .../button-dropdown/disabled-reason.page.tsx | 12 ++++- pages/button/disabled-reason-iframe.page.tsx | 17 ++++++ pages/button/disabled-reason.page.tsx | 48 ++++++++++------- pages/popover/with-iframe.page.tsx | 52 ++++++++++++++++++ pages/table/with-iframe.page.tsx | 29 ++++++++-- .../__integ__/with-iframe.test.ts | 21 ++++++++ .../button-dropdown-disabled-reason.test.ts | 46 ++++++++++++++++ .../__integ__/disabled-reason-iframe.test.ts | 53 +++++++++++++++++++ src/dropdown/internal.tsx | 25 +++++---- src/internal/components/tooltip/index.tsx | 6 ++- src/internal/utils/dom.ts | 4 ++ src/table/__integ__/inline-editing.test.ts | 18 +++++++ src/table/body-cell/click-away.tsx | 5 +- 15 files changed, 359 insertions(+), 39 deletions(-) create mode 100644 pages/annotation-context/with-iframe.page.tsx create mode 100644 pages/button-dropdown/disabled-reason-iframe.page.tsx create mode 100644 pages/button/disabled-reason-iframe.page.tsx create mode 100644 pages/popover/with-iframe.page.tsx create mode 100644 src/annotation-context/__integ__/with-iframe.test.ts create mode 100644 src/button/__integ__/disabled-reason-iframe.test.ts diff --git a/pages/annotation-context/with-iframe.page.tsx b/pages/annotation-context/with-iframe.page.tsx new file mode 100644 index 0000000000..8e05336493 --- /dev/null +++ b/pages/annotation-context/with-iframe.page.tsx @@ -0,0 +1,45 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import React from 'react'; + +import { Box, SpaceBetween } from '~components'; +import AnnotationContext from '~components/annotation-context'; +import Hotspot from '~components/hotspot'; + +import { annotationContextStrings } from '../onboarding/i18n'; +import tutorials from '../onboarding/tutorials'; +import { IframeWrapper } from '../utils/iframe-wrapper'; + +const tutorial = tutorials(() => {})[0]; + +function IframeContent() { + return ( + {}} + onExitTutorial={() => {}} + > + + +
+ Hotspot 1: +
+
+ Hotspot 2: +
+
+
+
+ ); +} + +export default function () { + return ( + +

Annotation context in iframe

+

Click the hotspot icons — the annotation popover should appear inside the iframe.

+ +
+ ); +} diff --git a/pages/button-dropdown/disabled-reason-iframe.page.tsx b/pages/button-dropdown/disabled-reason-iframe.page.tsx new file mode 100644 index 0000000000..ff68fdcd7a --- /dev/null +++ b/pages/button-dropdown/disabled-reason-iframe.page.tsx @@ -0,0 +1,17 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import React from 'react'; + +import { Box } from '~components'; + +import { IframeWrapper } from '../utils/iframe-wrapper'; +import { DisabledReasonDemo } from './disabled-reason.page'; + +export default function () { + return ( + +

ButtonDropdown disabled reason in iframe

+ +
+ ); +} diff --git a/pages/button-dropdown/disabled-reason.page.tsx b/pages/button-dropdown/disabled-reason.page.tsx index 82864fd812..4031380eba 100644 --- a/pages/button-dropdown/disabled-reason.page.tsx +++ b/pages/button-dropdown/disabled-reason.page.tsx @@ -133,11 +133,10 @@ export const selectableGroupItems: ButtonDropdownProps.Items = [ { text: 'Action', id: 'action', disabled: false }, ]; -export default function DescriptionPage() { +export function DisabledReasonDemo() { const [isRightAligned, setIsRightAligned] = useState(false); return ( <> -

Descriptions in ButtonDropdown