Use event.composedPath for getting event target

This commit is contained in:
Jakub Majorek
2022-09-08 18:56:11 +02:00
parent 147656b22f
commit a766ba35c9
+1 -1
View File
@@ -108,7 +108,7 @@ function useKeyOrCode(eventCode: string, keysToWatch: KeyCode): KeyOrCode {
}
function isInputDOMNode(event: KeyboardEvent): boolean {
const target = event.target as HTMLElement;
const target = event.composedPath()[0] as HTMLElement;
return ['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) || target?.hasAttribute('contenteditable');
}