Skip to content

Commit 75cc187

Browse files
kirstybrycejronald01
andauthoredMar 5, 2025··
[QUAR-706] Add custom z-index value for BpkPopover (#3763)
Co-authored-by: James Ronald <[email protected]>
1 parent 29b878d commit 75cc187

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed
 

‎packages/bpk-component-inset-banner/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default () => (
3030
popoverId: 'popover',
3131
labelTitle: true,
3232
closeBtnIcon: false,
33+
zIndexCustom: 1200;
3334
}}
3435
logo="logo.png"
3536
subheadline="My subheadline"

‎packages/bpk-component-inset-banner/src/BpkInsetBanner-test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe('BpkInsetBanner', () => {
6767
/>,
6868
);
6969

70-
const ctaButton = screen.getByTestId('adInfoBtn');
70+
const ctaButton = screen.getByTestId('ctaBtn');
7171

7272
fireEvent.click(ctaButton);
7373

‎packages/bpk-component-inset-banner/src/BpkInsetBanner.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export type Props = {
5151
popoverId?: string;
5252
labelTitle?: boolean;
5353
closeBtnIcon?: boolean;
54+
zIndexCustom?: number;
5455
};
5556
logo?: string;
5657
subheadline?: string;
@@ -121,11 +122,12 @@ const BpkInsetBanner = ({
121122
closeButtonText={callToAction?.buttonCloseLabel}
122123
closeButtonIcon={callToAction?.closeBtnIcon}
123124
labelAsTitle={callToAction?.labelTitle}
125+
zIndexValue={callToAction?.zIndexCustom}
124126
target={
125127
<button
126128
aria-label={callToAction?.buttonA11yLabel}
127129
className={getClassName('bpk-inset-banner--cta-button')}
128-
data-testid="adInfoBtn"
130+
data-testid="ctaBtn"
129131
aria-hidden="false"
130132
type="button"
131133
>

‎packages/bpk-component-popover/src/BpkPopover.module.scss

-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525

2626
$arrow-size: tokens.bpk-spacing-lg();
2727

28-
.bpk-popover--container {
29-
z-index: tokens.$bpk-zindex-popover;
30-
}
31-
3228
.bpk-popover {
3329
transition: opacity tokens.$bpk-duration-sm ease-in-out;
3430
outline: 0;

‎packages/bpk-component-popover/src/BpkPopover.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export type Props = CloseButtonProps & {
109109
target: ReactElement<any>;
110110
closeButtonLabel?: string;
111111
actionText?: string;
112+
zIndexValue?: number;
112113
onAction?: () => void;
113114
renderTarget?: () => HTMLElement | HTMLElement | undefined;
114115
[rest: string]: any;
@@ -134,6 +135,7 @@ const BpkPopover = ({
134135
renderTarget = () => undefined,
135136
showArrow = true,
136137
target,
138+
zIndexValue = 900,
137139
...rest
138140
}: Props) => {
139141
const [isOpenState, setIsOpenState] = useState(isOpen);
@@ -208,8 +210,8 @@ const BpkPopover = ({
208210
<div
209211
className={getClassName('bpk-popover--container')}
210212
ref={refs.setFloating}
211-
style={floatingStyles}
212213
{...getFloatingProps()}
214+
style={{ ...floatingStyles, zIndex: zIndexValue }}
213215
>
214216
<TransitionInitialMount
215217
appearClassName={getClassName('bpk-popover--appear')}

0 commit comments

Comments
 (0)
Please sign in to comment.