chore(isInputDOMNode): add event.target as fallback

This commit is contained in:
moklick
2022-09-14 14:30:10 +02:00
parent e152f726ff
commit e9daea7a10

View File

@@ -108,7 +108,8 @@ function useKeyOrCode(eventCode: string, keysToWatch: KeyCode): KeyOrCode {
}
function isInputDOMNode(event: KeyboardEvent): boolean {
const target = event.composedPath()[0] as HTMLElement;
// using composed path for handling shadow dom
const target = (event.composedPath?.()[0] || event.target) as HTMLElement;
return (
['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) ||