diff --git a/frontend/src/app/main/data/shortcuts_impl.js b/frontend/src/app/main/data/shortcuts_impl.js index 9be5beb059..e381cc150b 100644 --- a/frontend/src/app/main/data/shortcuts_impl.js +++ b/frontend/src/app/main/data/shortcuts_impl.js @@ -16,7 +16,7 @@ if (Mousetrap.addKeycodes) { } const target = Mousetrap.prototype || Mousetrap; -target.stopCallback = function(e, element, combo) { +target.stopCallback = function (e, element, combo) { // if the element has the data attribute "mousetrap-dont-stop" then no need // to stop. It should be used like
...
// or :div {:data-mousetrap-dont-stop true} @@ -24,6 +24,14 @@ target.stopCallback = function(e, element, combo) { return false } + if ('composedPath' in e && typeof e.composedPath === 'function') { + // For open shadow trees, update `element` so that the following check works. + const initialEventTarget = e.composedPath()[0]; + if (initialEventTarget !== e.target) { + element = initialEventTarget; + } + } + // stop for input, select, textarea and button const shouldStop = element.tagName == "INPUT" || element.tagName == "SELECT" ||