Skip to content

Commit f92611f

Browse files
authored
fix: Fix popover positioning inside query containers (#3469)
1 parent ad6d6d3 commit f92611f

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

pages/popover/scenarios.page.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import React, { useEffect, useState } from 'react';
4+
import clsx from 'clsx';
45

56
import { Select } from '~components';
67
import Box from '~components/box';
@@ -124,6 +125,20 @@ export default function () {
124125
With select
125126
</Popover>
126127
</section>
128+
129+
<section id="scenario-in-containment" className={clsx(styles.scenario, styles['containing-block'])}>
130+
<Popover
131+
position="left"
132+
size="medium"
133+
fixedWidth={true}
134+
header="Network interface eth0"
135+
content={<KeyValuePair />}
136+
dismissAriaLabel="Close"
137+
renderWithPortal={renderWithPortal}
138+
>
139+
eth0
140+
</Popover>
141+
</section>
127142
</SpaceBetween>
128143
</ScreenshotArea>
129144
</article>

pages/popover/scenarios.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
padding-inline: 0;
88
text-align: center;
99
}
10+
11+
.containing-block {
12+
contain: layout;
13+
}

src/internal/utils/dom.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export function isContainingBlock(element: HTMLElement): boolean {
1010
return (
1111
(!!computedStyle.transform && computedStyle.transform !== 'none') ||
1212
(!!computedStyle.perspective && computedStyle.perspective !== 'none') ||
13-
(!!computedStyle.containerType && computedStyle.containerType !== 'normal') ||
1413
computedStyle.contain?.split(' ').some(s => ['layout', 'paint', 'strict', 'content'].includes(s))
1514
);
1615
}

0 commit comments

Comments
 (0)