Skip to content

Commit

Permalink
🚸 Scrim: trigger dismiss on mousedown (#2923)
Browse files Browse the repository at this point in the history
  • Loading branch information
oddvernes committed Jun 22, 2023
1 parent c65e3de commit 29e14ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/eds-core-react/src/components/Scrim/Scrim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Scrim = forwardRef<HTMLDivElement, ScrimProps>(function Scrim(

const handleMouseClose = (event: MouseEvent) => {
if (event && event.target === scrimRef.current) {
if (event.type === 'click' && isDismissable && open) {
if (event.type === 'mousedown' && isDismissable && open) {
onClose && onClose()
}
}
Expand All @@ -61,7 +61,7 @@ export const Scrim = forwardRef<HTMLDivElement, ScrimProps>(function Scrim(
return (
<StyledScrim
lockScroll
onClick={handleMouseClose}
onMouseDown={handleMouseClose}
ref={combinedScrimRef}
{...rest}
>
Expand Down

0 comments on commit 29e14ea

Please sign in to comment.