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

Usage:

```
options=(hash triggerOnChangeOnTab=false)
```

This will prevent to select the row when pressing tab.
This commit is contained in:
Joffrey JAFFEUX 2020-05-19 20:39:29 +02:00 committed by GitHub
parent 42229fecad
commit 05d8091bd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,9 @@
{{#if showCategoryAdmin}}
{{categories-admin-dropdown
onChange=(action "selectCategoryAdminDropdownAction")
options=(hash
triggerOnChangeOnTab=false
)
}}
{{/if}}

View File

@ -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() {

View File

@ -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