diff options
author | MalumaDev <piano.lu92@gmail.com> | 2022-10-18 06:55:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 06:55:08 +0000 |
commit | 1997ccff13fc75af223f571e8c927c3d77273dd9 (patch) | |
tree | d3d8e4e64c1fb595bef205e531b03418328331f7 /javascript/progressbar.js | |
parent | 589215df22d24d560101ba2b1fd7aaf3233f466e (diff) | |
parent | 7432b6f4d2c3001895fc75411a34afae1810c1a2 (diff) | |
download | stable-diffusion-webui-gfx803-1997ccff13fc75af223f571e8c927c3d77273dd9.tar.gz stable-diffusion-webui-gfx803-1997ccff13fc75af223f571e8c927c3d77273dd9.tar.bz2 stable-diffusion-webui-gfx803-1997ccff13fc75af223f571e8c927c3d77273dd9.zip |
Merge branch 'master' into test_resolve_conflicts
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r-- | javascript/progressbar.js | 12 |
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 }) |