Use event.composedPath for getting event target

This commit is contained in:
Jakub Majorek
2022-09-08 18:56:11 +02:00
committed by moklick
parent dea46511c3
commit e152f726ff

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) ||