Skip to content

Commit c18b730

Browse files
committed
fix: dismiss when tapping on overlay only
1 parent b905036 commit c18b730

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/index.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,17 @@ export const SheetContent = forwardRef<HTMLDivElement, SheetContentProps>(
136136
windowRef.current = window;
137137
}, []);
138138

139+
const onTap = (event: Event) => {
140+
const target = event.target as HTMLDivElement;
141+
if (target.classList.contains("react-aria-ModalOverlay")) onDismiss();
142+
};
143+
139144
return (
140145
<AnimatePresence>
141146
{isOpen && (
142147
<MotionModalOverlay
148+
onTap={onTap}
143149
isOpen={isOpen}
144-
onTap={onDismiss}
145150
onOpenChange={onDismiss}
146151
style={{
147152
inset: 0,
@@ -166,7 +171,6 @@ export const SheetContent = forwardRef<HTMLDivElement, SheetContentProps>(
166171
borderTopLeftRadius: "0.75rem",
167172
borderTopRightRadius: "0.75rem",
168173
paddingBottom: window.screen.height,
169-
backgroundColor: "rgb(243, 232, 255)",
170174
...style,
171175
}}
172176
drag="y"

0 commit comments

Comments
 (0)