DEV: adds triggerOnChangeOnTab option to select-kit (#9833)

DEV: adds triggerOnChangeOnTab option to select-kit (#9833)

Usage:

options=(hash triggerOnChangeOnTab=false)

This will prevent to select the row when pressing tab.

diff --git a/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs b/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs
index e9e0b9a..2ac52d5 100644
--- a/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs
@@ -3,6 +3,9 @@
 {{#if showCategoryAdmin}}
   {{categories-admin-dropdown
     onChange=(action "selectCategoryAdminDropdownAction")
+    options=(hash
+      triggerOnChangeOnTab=false
+    )
   }}
 {{/if}}
 
diff --git a/app/assets/javascripts/select-kit/app/components/select-kit.js b/app/assets/javascripts/select-kit/app/components/select-kit.js
index f2fbbbf..140e967 100644
--- a/app/assets/javascripts/select-kit/app/components/select-kit.js
+++ b/app/assets/javascripts/select-kit/app/components/select-kit.js
@@ -271,7 +271,8 @@ export default Component.extend(
       selectedNameComponent: "selected-name",
       castInteger: false,
       preventsClickPropagation: false,
-      focusAfterOnChange: true
+      focusAfterOnChange: true,
+      triggerOnChangeOnTab: true
     },
 
     autoFilterable: computed("content.[]", "selectKit.filter", function() {
diff --git a/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-header.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-header.js
index 785b2a4..5697826 100644
--- a/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-header.js
+++ b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-header.js
@@ -140,7 +140,11 @@ export default Component.extend(UtilsMixin, {
       this._focusFilterInput();
     } else if (event.keyCode === 9) {
       // Tab
-      if (this.selectKit.highlighted && this.selectKit.isExpanded) {
+      if (
+        this.selectKit.highlighted &&
+        this.selectKit.isExpanded &&
+        this.selectKit.options.triggerOnChangeOnTab
+      ) {
         this.selectKit.select(
           this.getValue(this.selectKit.highlighted),
           this.selectKit.highlighted

GitHub sha: 05d8091b

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