Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

keyboard-nav directive for dropdown menu throws error when using up arrow first #4327

Closed
jfarago opened this issue Sep 2, 2015 · 7 comments

Comments

@jfarago
Copy link

jfarago commented Sep 2, 2015

When you click on a drop down menu and hit the up arrow the following error is thrown. Uncaught TypeError: Cannot read property 'focus' of undefined

If you hit down first and then up it is not an issue

@icfantv
Copy link
Contributor

icfantv commented Sep 2, 2015

This is fixed in master.

@jfarago
Copy link
Author

jfarago commented Sep 2, 2015

Installed the master, which resolved to angular-bootstrap#0b83ef6828, and the problem persists.

@icfantv
Copy link
Contributor

icfantv commented Sep 2, 2015

Crud. Yea, this is a bug. You can reproduce via this plunker which was used to fix #4091.

@icfantv icfantv reopened this Sep 2, 2015
@icfantv icfantv self-assigned this Sep 2, 2015
@icfantv
Copy link
Contributor

icfantv commented Sep 2, 2015

Hang on. That plunker is not using the latest code. I fixed #4091 and there were at least three issues. I need to test again w/ the latest code.

@icfantv
Copy link
Contributor

icfantv commented Sep 2, 2015

Yea, this is a bug. Here's an updated plunker. The problem is that dropdownCtrl.selectedOption is coming back as null so the ternary operator is setting dropdownCtrl.selectedOption to -1 because in JavaScript null - 1 === -1 and you can't have a -1 index into an array.

icfantv added a commit to icfantv/bootstrap that referenced this issue Sep 2, 2015
* add support for when user opens dropdown and then presses the up arrow key.

Fixes angular-ui#4327
@wesleycho wesleycho added this to the 0.13.4 (Maintenance) milestone Sep 2, 2015
icfantv added a commit to icfantv/bootstrap that referenced this issue Sep 2, 2015
* add support for when user opens dropdown and then presses the up arrow key.

Fixes angular-ui#4327
@icfantv icfantv closed this as completed in defcbbb Sep 2, 2015
@jfarago
Copy link
Author

jfarago commented Sep 3, 2015

Thank you for your quick response time fixing this bug

@icfantv
Copy link
Contributor

icfantv commented Sep 3, 2015

You're welcome. Just a note that ARIA does not specifically state that for menus, the up arrow should wrap and select the bottom (which is weird because it does for other widges - I saw at least accordion and radio groups).

That said, as I play with a menu on my Mac, it does wrap - which I think is the right use case.

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

3 participants