refactor(useKeyPress): cleanup

This commit is contained in:
moklick
2025-03-27 11:00:22 +01:00
parent 238664e322
commit 9b1c638de8
+1 -4
View File
@@ -104,10 +104,7 @@ export function useKeyPress(
const target = (event.composedPath?.()?.[0] || event.target) as Element | null;
const isInteractiveElement = target?.nodeName === 'BUTTON' || target?.nodeName === 'A';
if (
(options.preventDefault || typeof options.preventDefault === 'undefined') &&
(modifierPressed.current || !isInteractiveElement)
) {
if (options.preventDefault !== false && (modifierPressed.current || !isInteractiveElement)) {
event.preventDefault();
}