DEV: makes sk scroll to current selection (#9492)

DEV: makes sk scroll to current selection (#9492)

diff --git a/app/assets/javascripts/select-kit/components/select-kit.js b/app/assets/javascripts/select-kit/components/select-kit.js
index 7898179..a98687c 100644
--- a/app/assets/javascripts/select-kit/components/select-kit.js
+++ b/app/assets/javascripts/select-kit/components/select-kit.js
@@ -883,10 +883,31 @@ export default Component.extend(
 
       this._safeAfterRender(() => {
         this._focusFilter();
+        this._scrollToCurrent();
         this.popper && this.popper.update();
       });
     },
 
+    _scrollToCurrent() {
+      if (this.value && this.mainCollection) {
+        let highlighted;
+        if (this.valueProperty) {
+          highlighted = this.mainCollection.findBy(
+            this.valueProperty,
+            this.value
+          );
+        } else {
+          const index = this.mainCollection.indexOf(this.value);
+          highlighted = this.mainCollection.objectAt(index);
+        }
+
+        if (highlighted) {
+          this._scrollToRow(highlighted);
+          this.set("selectKit.highlighted", highlighted);
+        }
+      }
+    },
+
     _focusFilter(forceHeader = false) {
       this._safeAfterRender(() => {
         const input = this.getFilterInput();

GitHub sha: 79058a6d

This commit appears in #9492 which was merged by jjaffeux.