fix parent focus issues for Firefox and Chrome

This commit is contained in:
siikamiika 2019-09-01 22:34:37 +03:00 committed by toasted-nutbread
parent 2df9a7f977
commit f4b81eff30

View File

@ -239,9 +239,15 @@ class Popup {
} }
focusParent() { focusParent() {
this.container.blur();
if (this.parent && this.parent.container) { if (this.parent && this.parent.container) {
this.parent.container.focus(); // Chrome doesn't like focusing iframe without contentWindow.
this.parent.container.contentWindow.focus();
} else {
// Firefox doesn't like focusing window without first blurring the iframe.
// this.container.contentWindow.blur() doesn't work on Firefox for some reason.
this.container.blur();
// This is needed for Chrome.
window.focus();
} }
} }