diff options
author | papuSpartan <30642826+papuSpartan@users.noreply.github.com> | 2022-12-10 08:02:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-10 08:02:39 +0000 |
commit | 6387043fd2c3311d66690ff27d7da0e030b29cd8 (patch) | |
tree | 075559ce3e52511cdd459da2b4cc33360d6eb258 /javascript/progressbar.js | |
parent | 00ebc26c4e2962a31e067539d89cd695d999539a (diff) | |
parent | 1d01404c5615debfca24f7fbe429ddd2f5b11eb9 (diff) | |
download | stable-diffusion-webui-gfx803-6387043fd2c3311d66690ff27d7da0e030b29cd8.tar.gz stable-diffusion-webui-gfx803-6387043fd2c3311d66690ff27d7da0e030b29cd8.tar.bz2 stable-diffusion-webui-gfx803-6387043fd2c3311d66690ff27d7da0e030b29cd8.zip |
Merge branch 'AUTOMATIC1111:master' into master
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r-- | javascript/progressbar.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js index 671fde34..d58737c4 100644 --- a/javascript/progressbar.js +++ b/javascript/progressbar.js @@ -23,7 +23,7 @@ function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip if(opts.show_progress_in_title && progressbar && progressbar.offsetParent){ if(progressbar.innerText){ - let newtitle = 'Stable Diffusion - ' + progressbar.innerText + let newtitle = '[' + progressbar.innerText.trim() + '] Stable Diffusion'; if(document.title != newtitle){ document.title = newtitle; } @@ -92,14 +92,26 @@ function check_gallery(id_gallery){ if (prevSelectedIndex !== -1 && galleryButtons.length>prevSelectedIndex && !galleryBtnSelected) { // automatically re-open previously selected index (if exists) activeElement = gradioApp().activeElement; + let scrollX = window.scrollX; + let scrollY = window.scrollY; galleryButtons[prevSelectedIndex].click(); showGalleryImage(); + // When the gallery button is clicked, it gains focus and scrolls itself into view + // We need to scroll back to the previous position + setTimeout(function (){ + window.scrollTo(scrollX, scrollY); + }, 50); + 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); + // if someone has a better solution please by all means + setTimeout(function (){ + activeElement.focus({ + preventScroll: true // Refocus the element that was focused before the gallery was opened without scrolling to it + }) + }, 1); } } }) |