Merge pull request #33 from EllangoK/main

Removes originalTarget (only works in Firefox), instead uses composedPath() to find original target (works everywhere)
pull/47/head
AlUlkesh 2023-02-12 10:52:49 +01:00 committed by GitHub
commit 41d91f8dc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -220,8 +220,13 @@ 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") {
let target;
if (!event.composed) { // We shouldn't get here as the Shadow DOM is always active, but just in case
target = event.target;
} else {
target = event.composedPath()[0];
}
if (!target || target.nodeName === "INPUT" || target.nodeName === "TEXTAREA") {
return;
}