Fix #5760 - tm-focus-selector doesn't work in new windows (#5766)

* Pass the original event to invokeActionString

* Update rootwidget.js
new-json-store-area
Simon Huber 2021-06-06 13:42:28 +02:00 zatwierdzone przez GitHub
rodzic 2f1806ab6a
commit c18b7527a7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -324,7 +324,7 @@ KeyboardManager.prototype.handleKeydownEvent = function(event) {
if(key !== undefined) {
event.preventDefault();
event.stopPropagation();
$tw.rootWidget.invokeActionString(action,$tw.rootWidget);
$tw.rootWidget.invokeActionString(action,$tw.rootWidget,event);
return true;
}
return false;

Wyświetl plik

@ -40,9 +40,10 @@ exports.startup = function() {
// Install the tm-focus-selector message
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
var selector = event.param || "",
element;
element,
doc = event.event ? event.event.target.ownerDocument : document;
try {
element = document.querySelector(selector);
element = doc.querySelector(selector);
} catch(e) {
console.log("Error in selector: ",selector)
}