File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export interface DrawerPopupProps {
25
25
// Root
26
26
rootClassName ?: string ;
27
27
rootStyle ?: React . CSSProperties ;
28
+ zIndex ?: number ;
28
29
29
30
// Drawer
30
31
placement ?: Placement ;
@@ -69,6 +70,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
69
70
// Root
70
71
rootClassName,
71
72
rootStyle,
73
+ zIndex,
72
74
73
75
// Drawer
74
76
className,
@@ -153,6 +155,12 @@ export default function DrawerPopup(props: DrawerPopupProps) {
153
155
}
154
156
} ;
155
157
158
+ // =========================== zIndex ===========================
159
+ const zIndexStyle : React . CSSProperties = { } ;
160
+ if ( zIndex ) {
161
+ zIndexStyle . zIndex = zIndex ;
162
+ }
163
+
156
164
// ============================ Mask ============================
157
165
const maskNode : React . ReactNode = mask && (
158
166
< CSSMotion key = "mask" { ...maskMotion } visible = { open } >
@@ -167,6 +175,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
167
175
style = { {
168
176
...motionMaskStyle ,
169
177
...maskStyle ,
178
+ ...zIndexStyle ,
170
179
} }
171
180
onClick = { maskClosable && onClose }
172
181
/>
@@ -203,6 +212,7 @@ export default function DrawerPopup(props: DrawerPopupProps) {
203
212
style = { {
204
213
...wrapperStyle ,
205
214
...contentWrapperStyle ,
215
+ ...zIndexStyle ,
206
216
} }
207
217
>
208
218
< CSSMotion
Original file line number Diff line number Diff line change @@ -255,4 +255,17 @@ describe('rc-drawer-menu', () => {
255
255
expect ( onClose ) . not . toHaveBeenCalled ( ) ;
256
256
} ) ;
257
257
} ) ;
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
+ } ) ;
258
271
} ) ;
You can’t perform that action at this time.
0 commit comments