FIX: override backspaceFromFilter only if defined

This commit is contained in:
Joffrey JAFFEUX 2018-02-13 17:48:00 +01:00 committed by GitHub
parent 20e44b3c14
commit 20123271d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -83,6 +83,10 @@ export default ComboBox.extend({
}
},
backspaceFromFilter(event) {
this.didPressBackspace(event);
},
didPressBackspace() {
if (!this.get("isExpanded")) {
this.expand();

View File

@ -108,7 +108,9 @@ export default Ember.Mixin.create({
.on("keydown.select-kit", (event) => {
const keyCode = event.keyCode || event.which;
if (keyCode === this.keys.BACKSPACE) this.backspaceFromFilter(event);
if (keyCode === this.keys.BACKSPACE && typeof this.backspaceFromFilter === "function") {
this.backspaceFromFilter(event)
};
if (keyCode === this.keys.TAB) this.tabFromFilter(event);
if (keyCode === this.keys.ESC) this.escapeFromFilter(event);
if (keyCode === this.keys.ENTER) this.enterFromFilter(event);
@ -208,7 +210,6 @@ export default Ember.Mixin.create({
upAndDownFromFilter(event) { this.didPressUpAndDownArrows(event); },
backspaceFromHeader(event) { this.didPressBackspace(event); },
backspaceFromFilter(event) { this.didPressBackspace(event); },
enterFromHeader(event) { this.didPressEnter(event); },
enterFromFilter(event) { this.didPressEnter(event); },