Chromium Code Reviews| Index: ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js |
| diff --git a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js |
| index a8e065db682e77c39cd3f2a1cb2e694e684c8ea7..2a75c307095dd2ee3264e614c2f0075af304a878 100644 |
| --- a/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js |
| +++ b/ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js |
| @@ -124,6 +124,10 @@ Polymer({ |
| var focusedIndex = |
| Array.prototype.indexOf.call(this.options_, this.root.activeElement); |
| + // Avoid off-by-one when nothing is focused and up is pressed. |
|
dpapad
2017/04/05 21:49:13
Nit (optional): Perhaps just rephrase to
// Handle
scottchen
2017/04/06 17:54:02
Done.
|
| + if (focusedIndex === -1 && step === -1) |
| + focusedIndex = 0; |
| + |
| do { |
| focusedIndex = (numOptions + focusedIndex + step) % numOptions; |
| nextOption = this.options_[focusedIndex]; |