Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: switch to onClick from onMouseDown in modal components #16847

Merged
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}
davidmenendez marked this conversation as resolved.
Show resolved Hide resolved
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
Loading