Fix opening the dropdown could cause the entire page to scroll

This commit is contained in:
Xon 2026-03-17 21:16:36 +08:00
commit 2ebef172db

View file

@ -527,8 +527,8 @@ class Choices {
);
if (activeElement !== null && !isScrolledIntoView(activeElement, this.choiceList.element)) {
// We use the native scrollIntoView function instead of choiceList.scrollToChildElement to avoid animated scroll.
activeElement.scrollIntoView();
// scrollIntoView can cause entire page scrolling, scrollToChildElement causes undesired animation
this.choiceList.element.scrollTop = activeElement.offsetTop;
}
});