Fix: focus options when activated

This commit is contained in:
eight 2020-02-01 07:50:49 +08:00
parent b4662f1523
commit 469d6a537a
2 changed files with 6 additions and 10 deletions

View File

@ -706,13 +706,14 @@ function highlightEditedStyle() {
function embedOptions() {
const options = $('#stylus-embedded-options');
let options = $('#stylus-embedded-options');
if (!options) {
const iframe = document.createElement('iframe');
iframe.id = 'stylus-embedded-options';
iframe.src = '/options.html';
document.documentElement.appendChild(iframe);
options = document.createElement('iframe');
options.id = 'stylus-embedded-options';
options.src = '/options.html';
document.documentElement.appendChild(options);
}
options.focus();
}
function unembedOptions() {

View File

@ -302,8 +302,3 @@ window.onkeydown = event => {
top.dispatchEvent(new CustomEvent('closeOptions'));
}
};
// FF is slow to allow focus, particularly when launched via manager button
setTimeout(() => {
window.focus();
}, 100);