feat(useKeyPress): add additional check for nokey classname to support custom inputs closes #2254

This commit is contained in:
Christopher Möller
2022-08-01 18:27:58 +02:00
parent f7dc75b0f3
commit 8fe0b97776

View File

@@ -110,5 +110,9 @@ function useKeyOrCode(eventCode: string, keysToWatch: KeyCode): KeyOrCode {
function isInputDOMNode(event: KeyboardEvent): boolean {
const target = event.target as HTMLElement;
return ['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) || target?.hasAttribute('contenteditable');
return (
['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) ||
target?.hasAttribute('contenteditable') ||
!!target?.closest('.nokey')
);
}