Handle modifier keys (#74237)
This commit is contained in:
parent
b42f64d1a2
commit
89dba39273
|
@ -68,6 +68,9 @@ export const useLinkProps = (
|
||||||
|
|
||||||
const onClick = useMemo(() => {
|
const onClick = useMemo(() => {
|
||||||
return (e: React.MouseEvent | React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {
|
return (e: React.MouseEvent | React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {
|
||||||
|
if (e.defaultPrevented || isModifiedEvent(e)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const navigate = () => {
|
const navigate = () => {
|
||||||
|
@ -112,3 +115,6 @@ const validateParams = ({ app, pathname, hash, search }: LinkDescriptor) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isModifiedEvent = (event: any) =>
|
||||||
|
!!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
||||||
|
|
Loading…
Reference in a new issue