A platform for community discussion. Free, open, simple.
DEV: makes sk scroll to current selection (#9492)
Joffrey JAFFEUX79058a6d9982
diff --git a/app/assets/javascripts/select-kit/components/select-kit.js b/app/assets/javascripts/select-kit/components/select-kit.jsindex 7898179be01..a98687caab2 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();