From 6b30de46e6467de46b0427f753bf2dfd98befedb Mon Sep 17 00:00:00 2001 From: Sebastian Zoglowek <55794780+zoglo@users.noreply.github.com> Date: Wed, 26 Nov 2025 19:14:25 +0100 Subject: [PATCH] Scroll the first selected option into the view --- src/scripts/choices.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/scripts/choices.ts b/src/scripts/choices.ts index 813f01e0..da7f2d61 100644 --- a/src/scripts/choices.ts +++ b/src/scripts/choices.ts @@ -521,6 +521,15 @@ class Choices { } this.passedElement.triggerEvent(EventType.showDropdown); + + const activeElement = this.choiceList.element.querySelector( + getClassNamesSelector(this.config.classNames.selectedState), + ); + + if (activeElement !== null && !isScrolledIntoView(activeElement, this.choiceList.element)) { + // We use the native scrollIntoView function instead of choiceList.scrollToChildElement to avoid smooth scroll. + activeElement.scrollIntoView(); + } }); return this;