Skip to content

Commit 1193f3d

Browse files
Ryan Holtemakepanic
authored andcommitted
bugfix: fixes bug where typing state was starting even on arrow key press
Signed-off-by: Ryan Holte <[email protected]>
1 parent 959b065 commit 1193f3d

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

addon/components/keyword-complete.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,19 @@ export default Ember.Component.extend({
453453
this.set('caretPosition', caretPosition + 1);
454454
},
455455

456+
/**
457+
* starts the typing state if enabled
458+
*/
459+
runShowTypingState() {
460+
// TODO: figure out if this has to be run on up/down
461+
if (this.get('shouldShowTypingState')) {
462+
this.set('showTypingState', true);
463+
run.later(this, () => {
464+
this.set('showTypingState', false);
465+
}, this.get('typingStateTimeout'));
466+
}
467+
},
468+
456469
/**
457470
* Function called on target 'keydown'. Used to handle "special" key presses.
458471
* @param {jQuery.Event} ev
@@ -508,14 +521,6 @@ export default Ember.Component.extend({
508521
}
509522
}
510523

511-
// TODO: figure out if this has to be run on up/down
512-
if (visible && this.get('shouldShowTypingState')) {
513-
this.set('showTypingState', true);
514-
run.later(this, () => {
515-
this.set('showTypingState', false);
516-
}, this.get('typingStateTimeout'));
517-
}
518-
519524
let selectionIdx = this.get('selectionIdx');
520525
switch (keyCode) {
521526
case KEYS.ENTER:
@@ -571,6 +576,10 @@ export default Ember.Component.extend({
571576
}
572577
break;
573578
}
579+
default:
580+
if (visible) {
581+
this.runShowTypingState()
582+
}
574583
}
575584
},
576585

0 commit comments

Comments
 (0)