aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/progressbar.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-19 06:43:49 +0000
committerGitHub <noreply@github.com>2022-10-19 06:43:49 +0000
commit05315d8a236e252221bbbdd9e8f459b8a31c3524 (patch)
tree0bce187060568747888571fafedca4974fe17af3 /javascript/progressbar.js
parent9a33292ce41b01252cdb8ab6214a11d274e32fa0 (diff)
parent1d4aa376e6111e90888a30ae24d2bcd7f978ec51 (diff)
downloadstable-diffusion-webui-gfx803-05315d8a236e252221bbbdd9e8f459b8a31c3524.tar.gz
stable-diffusion-webui-gfx803-05315d8a236e252221bbbdd9e8f459b8a31c3524.tar.bz2
stable-diffusion-webui-gfx803-05315d8a236e252221bbbdd9e8f459b8a31c3524.zip
Merge branch 'master' into hot-reload-javascript
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r--javascript/progressbar.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js
index 076f0a97..7a05726e 100644
--- a/javascript/progressbar.js
+++ b/javascript/progressbar.js
@@ -34,7 +34,7 @@ function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip
preview.style.height = gallery.clientHeight + "px"
//only watch gallery if there is a generation process going on
- check_gallery(id_gallery);
+ check_gallery(id_gallery);
var progressDiv = gradioApp().querySelectorAll('#' + id_progressbar_span).length > 0;
if(!progressDiv){
@@ -72,9 +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)
+ // automatically re-open previously selected index (if exists)
+ activeElement = gradioApp().activeElement;
+
galleryButtons[prevSelectedIndex].click();
- showGalleryImage();
+ showGalleryImage();
+
+ 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 })