diff --git a/javascript/image_browser.js b/javascript/image_browser.js index c184942..b349e5c 100644 --- a/javascript/image_browser.js +++ b/javascript/image_browser.js @@ -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; }