allows for keydown to run even if not composed

this should not happen regardless, but is safer
pull/33/head
EllangoK 2023-02-11 21:50:17 -05:00
parent 61f2e40e3b
commit f949a4a932
1 changed files with 4 additions and 2 deletions

View File

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