mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-06-26 21:01:16 -03:00
fix(ui): prevent scroll jump on model card click caused by sort dropdown focus
The document-level click handler in SortDropdown.js called trigger.focus() unconditionally on every click outside the sort group. When a model card was clicked to open the modal, focus() triggered scrollIntoView on the .sort-trigger button, perturbing .page-content.scrollTop and causing the card grid to jump up a few pixels. The same interference also broke the back-to-top smooth-scroll animation: frame-by-frame focus/scroll perturbations caused VirtualScroller to schedule repeated re-renders, interrupting the compositor-thread scroll. Fix: only return focus to the trigger when the dropdown was actually open, so ordinary page clicks (e.g. clicking a model card) never force focus.
This commit is contained in:
@@ -230,8 +230,12 @@ export function initSortDropdown(select) {
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener('click', (event) => {
|
||||
if (!group.contains(event.target)) {
|
||||
const wasOpen = group.classList.contains('active');
|
||||
close();
|
||||
trigger.focus();
|
||||
// Only return focus to the trigger when the dropdown was actually
|
||||
// open — avoids forcing scrollIntoView on every page click (which
|
||||
// causes the scroll container to jump when clicking a model card).
|
||||
if (wasOpen) trigger.focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user