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() { function embedOptions() {
const options = $('#stylus-embedded-options'); let options = $('#stylus-embedded-options');
if (!options) { if (!options) {
const iframe = document.createElement('iframe'); options = document.createElement('iframe');
iframe.id = 'stylus-embedded-options'; options.id = 'stylus-embedded-options';
iframe.src = '/options.html'; options.src = '/options.html';
document.documentElement.appendChild(iframe); document.documentElement.appendChild(options);
} }
options.focus();
} }
function unembedOptions() { function unembedOptions() {

View File

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