Merge pull request #2416 from jwm0/main
Use event.composedPath for getting event target (keydown shadow DOM fix)
This commit is contained in:
@@ -108,7 +108,7 @@ function useKeyOrCode(eventCode: string, keysToWatch: KeyCode): KeyOrCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isInputDOMNode(event: KeyboardEvent): boolean {
|
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');
|
return ['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) || target?.hasAttribute('contenteditable');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user