aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/progressbar.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-18 11:04:17 +0000
committerGitHub <noreply@github.com>2022-10-18 11:04:17 +0000
commitf6c758d055ca8e181d5bfc056cb85ff5a2df7f66 (patch)
treedd1a7276d6d43f950227e54dbae28fbf6801d35b /javascript/progressbar.js
parent665beebc0825a6fad410c8252f27f6f6f0bd900b (diff)
parentc71008c74156635558bb2e877d1628913f6f781e (diff)
downloadstable-diffusion-webui-gfx803-f6c758d055ca8e181d5bfc056cb85ff5a2df7f66.tar.gz
stable-diffusion-webui-gfx803-f6c758d055ca8e181d5bfc056cb85ff5a2df7f66.tar.bz2
stable-diffusion-webui-gfx803-f6c758d055ca8e181d5bfc056cb85ff5a2df7f66.zip
Merge branch 'master' into dark-mode
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r--javascript/progressbar.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js
index c7d0343f..7a05726e 100644
--- a/javascript/progressbar.js
+++ b/javascript/progressbar.js
@@ -72,11 +72,17 @@ function check_gallery(id_gallery){
let galleryButtons = gradioApp().querySelectorAll('#'+id_gallery+' .gallery-item')
let galleryBtnSelected = gradioApp().querySelector('#'+id_gallery+' .gallery-item.\\!ring-2')
if (prevSelectedIndex !== -1 && galleryButtons.length>prevSelectedIndex && !galleryBtnSelected) {
- //automatically re-open previously selected index (if exists)
- activeElement = document.activeElement;
+ // automatically re-open previously selected index (if exists)
+ activeElement = gradioApp().activeElement;
+
galleryButtons[prevSelectedIndex].click();
showGalleryImage();
- if(activeElement) activeElement.focus()
+
+ if(activeElement){
+ // i fought this for about an hour; i don't know why the focus is lost or why this helps recover it
+ // if somenoe has a better solution please by all means
+ setTimeout(function() { activeElement.focus() }, 1);
+ }
}
})
galleryObservers[id_gallery].observe( gallery, { childList:true, subtree:false })