refactor(useKeyPress): cleanup
This commit is contained in:
@@ -104,10 +104,7 @@ export function useKeyPress(
|
|||||||
const target = (event.composedPath?.()?.[0] || event.target) as Element | null;
|
const target = (event.composedPath?.()?.[0] || event.target) as Element | null;
|
||||||
const isInteractiveElement = target?.nodeName === 'BUTTON' || target?.nodeName === 'A';
|
const isInteractiveElement = target?.nodeName === 'BUTTON' || target?.nodeName === 'A';
|
||||||
|
|
||||||
if (
|
if (options.preventDefault !== false && (modifierPressed.current || !isInteractiveElement)) {
|
||||||
(options.preventDefault || typeof options.preventDefault === 'undefined') &&
|
|
||||||
(modifierPressed.current || !isInteractiveElement)
|
|
||||||
) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user