File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
apps/renderer/src/components/ui/modal/stacked Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ export const ModalInternal = memo(
241
241
< Dialog . Content
242
242
asChild
243
243
aria-describedby = { undefined }
244
- onPointerDownOutside = { ( event ) => event . preventDefault ( ) }
244
+ onPointerDownOutside = { preventDefault }
245
245
onOpenAutoFocus = { openAutoFocus }
246
246
>
247
247
< div
@@ -291,7 +291,6 @@ export const ModalInternal = memo(
291
291
< Dialog . Content
292
292
asChild
293
293
aria-describedby = { undefined }
294
- // @ts -expect-error
295
294
onPointerDownOutside = { preventDefault }
296
295
onOpenAutoFocus = { openAutoFocus }
297
296
>
Original file line number Diff line number Diff line change @@ -32,14 +32,16 @@ const ModalStack = () => {
32
32
const overlayOptions = stack [ overlayIndex ] ?. overlayOptions
33
33
34
34
const hasModalStack = stack . length > 0
35
+ const topModalIsNotSetAsAModal = topModalIndex !== stack . length - 1
35
36
36
37
useEffect ( ( ) => {
37
38
// NOTE: document.body is being used by radix's dismissable,
38
39
// and using that will cause radix to get the value of `none` as the store value,
39
40
// and then revert to `none` instead of `auto` after a modal dismiss.
40
- document . documentElement . style . pointerEvents = hasModalStack ? "none" : "auto"
41
+ document . documentElement . style . pointerEvents =
42
+ hasModalStack && ! topModalIsNotSetAsAModal ? "none" : "auto"
41
43
document . documentElement . dataset . hasModal = hasModalStack . toString ( )
42
- } , [ hasModalStack ] )
44
+ } , [ hasModalStack , topModalIsNotSetAsAModal ] )
43
45
return (
44
46
< AnimatePresence mode = "popLayout" >
45
47
{ stack . map ( ( item , index ) => (
Original file line number Diff line number Diff line change 1
- import type { ReactEventHandler } from "react"
1
+ export const stopPropagation = < T extends { stopPropagation : ( ) => any } > ( e : T ) =>
2
+ e . stopPropagation ( )
2
3
3
- export const stopPropagation : ReactEventHandler < any > = ( e ) => e . stopPropagation ( )
4
-
5
- export const preventDefault : ReactEventHandler < any > = ( e ) => e . preventDefault ( )
4
+ export const preventDefault = < T extends { preventDefault : ( ) => any } > ( e : T ) => e . preventDefault ( )
6
5
7
6
export const nextFrame = ( fn : ( ...args : any [ ] ) => any ) => {
8
7
requestAnimationFrame ( ( ) => {
You can’t perform that action at this time.
0 commit comments