Skip to content

Commit

Permalink
fix: switch onmousedown to onclick handler in modal components
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmenendez committed Jun 21, 2024
1 parent 250923e commit bc99a9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/components/ComposedModal/ComposedModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const ComposedModal = React.forwardRef<HTMLDivElement, ComposedModalProps>(
onKeyDown?.(event);
}

function handleMousedown(evt: React.MouseEvent<HTMLDivElement>) {
function handleClick(evt: React.MouseEvent<HTMLDivElement>) {
const target = evt.target as Node;
evt.stopPropagation();
if (
Expand Down Expand Up @@ -421,7 +421,7 @@ const ComposedModal = React.forwardRef<HTMLDivElement, ComposedModalProps>(
ref={ref}
aria-hidden={!open}
onBlur={!focusTrapWithoutSentinels ? handleBlur : () => {}}
onMouseDown={handleMousedown}
onClick={handleClick}
onKeyDown={handleKeyDown}
className={modalClass}>
<div
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const Modal = React.forwardRef(function Modal(
}
}

function handleMousedown(evt: React.MouseEvent<HTMLDivElement>) {
function handleOnclick(evt: React.MouseEvent<HTMLDivElement>) {
const target = evt.target as Node;
evt.stopPropagation();
if (
Expand Down Expand Up @@ -584,7 +584,7 @@ const Modal = React.forwardRef(function Modal(
<div
{...rest}
onKeyDown={handleKeyDown}
onMouseDown={handleMousedown}
onClick={handleOnclick}
onBlur={!focusTrapWithoutSentinels ? handleBlur : () => {}}
className={modalClasses}
role="presentation"
Expand Down

0 comments on commit bc99a9f

Please sign in to comment.