Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Arrow up and down events are canceled #384

Closed
deje1011 opened this issue Mar 4, 2015 · 5 comments
Closed

Arrow up and down events are canceled #384

deje1011 opened this issue Mar 4, 2015 · 5 comments

Comments

@deje1011
Copy link

deje1011 commented Mar 4, 2015

Hello Michael,

thank you for writing and maintaining this directive. We are using it inside of a table in which the user should be able to navigate using the arrow keys (in combination with ctrl). Unfortunately we are not able to retrieve the arrow up and arrow down events as they are canceled in this event handler:

...
// Version 1.3.0 (line 603)
.on('input-keydown', function(e) {
   ...
   if (handled) {
         e.preventDefault();
         e.stopImmediatePropagation();
         scope.$apply();
   }
});

Would it be possible to leave out the stopImmediatePropagation-line?

Looking forward to your response,
Jesse

@deje1011 deje1011 changed the title Arrow Up and Down events are canceled Arrow up and down events are canceled Mar 5, 2015
@mbenford
Copy link
Owner

Events are only stopped from begin propagated when they have been handled by the directive. This helps prevent side effects from happening. But, when a modifier is activated (e.g. ctrl, alt, shift), the directive ignores the event altogether, so in your case everything should work.

I don't know what version you are using. There is no v1.3.0. Never was. Are you using a fork?

@mbenford
Copy link
Owner

Any update on this?

@deje1011
Copy link
Author

Thank you for replying. I only received a notification about your second answer, so thanks again for helping github to keep me up to date.
We are using version 2.1.1, I have no idea how i mixed that up. However, when I listen for the keydown event and print out the key-code, it does not fire as I press the up/down arrows (even in combination with alt/shift/ctrl). The key-codes for alt, shift and ctrl (and every other key as it seems) are logged properly.

As soon as I find the time, I will try to reproduce the case in an isolated example.

@deje1011
Copy link
Author

deje1011 commented Apr 7, 2015

http://codepen.io/jjd/pen/JoqGvp

As long as there are items inside the autocompletion list, the events for going up and down do not bubble up (even if you press ctrl/alt/shift). The behavior makes sense but for us it would be much nicer to be able to listen for the event.

@mbenford
Copy link
Owner

mbenford commented Apr 8, 2015

Ok, I found out there's a bug in the autocomplete directive and keystrokes aren't ignored when a modifier is on. I'll add this to the backlog.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants