check first element of composed path for target

pull/33/head
EllangoK 2023-02-11 21:30:37 -05:00
parent 0416810adf
commit 61f2e40e3b
1 changed files with 5 additions and 2 deletions

View File

@ -220,8 +220,11 @@ gradioApp().addEventListener("keydown", function(event) {
}
// If the user is typing in an input field, dont listen for keypresses
let target = event.originalTarget || event.explicitOriginalTarget;
if (target.nodeName === "INPUT" || target.nodeName === "TEXTAREA") {
if (!event.composed) { // We shouldn't get here as the Shadow DOM is always active, but just in case
return;
}
let target = event.composedPath()[0];
if (!target || target.nodeName === "INPUT" || target.nodeName === "TEXTAREA") {
return;
}