Skip to content

Commit 1487051

Browse files
committed
chore: zIndex
1 parent 43def1c commit 1487051

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/DrawerPopup.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface DrawerPopupProps {
2525
// Root
2626
rootClassName?: string;
2727
rootStyle?: React.CSSProperties;
28+
zIndex?: number;
2829

2930
// Drawer
3031
placement?: Placement;
@@ -69,6 +70,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
6970
// Root
7071
rootClassName,
7172
rootStyle,
73+
zIndex,
7274

7375
// Drawer
7476
className,
@@ -153,6 +155,12 @@ export default function DrawerPopup(props: DrawerPopupProps) {
153155
}
154156
};
155157

158+
// =========================== zIndex ===========================
159+
const zIndexStyle: React.CSSProperties = {};
160+
if (zIndex) {
161+
zIndexStyle.zIndex = zIndex;
162+
}
163+
156164
// ============================ Mask ============================
157165
const maskNode: React.ReactNode = mask && (
158166
<CSSMotion key="mask" {...maskMotion} visible={open}>
@@ -167,6 +175,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
167175
style={{
168176
...motionMaskStyle,
169177
...maskStyle,
178+
...zIndexStyle,
170179
}}
171180
onClick={maskClosable && onClose}
172181
/>
@@ -203,6 +212,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
203212
style={{
204213
...wrapperStyle,
205214
...contentWrapperStyle,
215+
...zIndexStyle,
206216
}}
207217
>
208218
<CSSMotion

tests/index.spec.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,17 @@ describe('rc-drawer-menu', () => {
255255
expect(onClose).not.toHaveBeenCalled();
256256
});
257257
});
258+
259+
it('zIndex', () => {
260+
const { container } = render(
261+
<Drawer zIndex={93} open getContainer={false} />,
262+
);
263+
264+
expect(container.querySelector('.rc-drawer-mask')).toHaveStyle({
265+
zIndex: 93,
266+
});
267+
expect(container.querySelector('.rc-drawer-content-wrapper')).toHaveStyle({
268+
zIndex: 93,
269+
});
270+
});
258271
});

0 commit comments

Comments
 (0)