Skip to content

Commit

Permalink
Fix keyup event so that it does not trigger dropdown on escape again,…
Browse files Browse the repository at this point in the history
… also fixes up and down arrows after initial detection of trigger.
  • Loading branch information
Jordan Humphreys committed Mar 4, 2016
1 parent 8cd43bb commit de30bc4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion dist/tribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,12 @@ if (!Array.prototype.find) {
if (!this.tribute.isActive) return false;

if (this.tribute.current.mentionText.length === 0) {
return true;
var eventKeyPressed = false;
TributeEvents.keys().forEach(function (o) {
if (event.keyCode === o.key) eventKeyPressed = true;
});

return !eventKeyPressed;
}

return false;
Expand All @@ -360,6 +365,8 @@ if (!Array.prototype.find) {

instance.updateSelection(this);

if (event.keyCode === 27) return;

if (!instance.tribute.isActive) {
var _ret2 = function () {
var keyCode = instance.getKeyCode(instance, _this5, event);
Expand Down
9 changes: 8 additions & 1 deletion src/tribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ if (!Array.prototype.find) {
if (!this.tribute.isActive) return false

if (this.tribute.current.mentionText.length === 0) {
return true
let eventKeyPressed = false
TributeEvents.keys().forEach(o => {
if (event.keyCode === o.key) eventKeyPressed = true
})

return !eventKeyPressed
}

return false
Expand All @@ -306,6 +311,8 @@ if (!Array.prototype.find) {
keyup(instance, event) {
instance.updateSelection(this)

if (event.keyCode === 27) return

if (!instance.tribute.isActive) {
let keyCode = instance.getKeyCode(instance, this, event)

Expand Down

0 comments on commit de30bc4

Please sign in to comment.