chore(isInputDOMNode): add event.target as fallback
This commit is contained in:
@@ -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) || target?.hasAttribute('contenteditable');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user