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 9f58dc4f6cd9079f59c2ee05364b0f1f5aef5e46..3ed96d1f8ea38a2839230611509d78edaabc1016 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 |
| @@ -32,6 +32,7 @@ Polymer({ |
| listeners: { |
| 'keydown': 'onKeyDown_', |
| + 'mousemove': 'onMouseMove_', |
| 'tap': 'onTap_', |
| }, |
| @@ -83,6 +84,27 @@ Polymer({ |
| e.preventDefault(); |
| }, |
| + debounceFlusher_: null, |
| + |
|
Dan Beam
2017/04/04 22:32:00
jsdoc here (@private, @param)
scottchen
2017/04/04 23:07:27
Done.
|
| + onMouseMove_: function(e) { |
| + var target = e.target; |
| + |
| + if(!this.debounceFlusher_) { |
|
Dan Beam
2017/04/04 22:32:00
please use `git cl format --js` and/or stop forget
scottchen
2017/04/04 23:07:27
I've formatted in the latest patch before you comm
|
| + this.debounceFlusher_ = setTimeout(function(){ |
| + this.flushDebouncer('cr-action-menu-mousemove'); |
| + this.debounceFlusher_ = null; |
| + }.bind(this), 10); |
| + } |
| + |
| + this.debounce('cr-action-menu-mousemove', function(){ |
|
Dan Beam
2017/04/04 22:32:00
i don't understand why you need this debounce nor
scottchen
2017/04/04 23:07:27
mousemove fires a lot, so I was trying to make the
|
| + if(target.classList.contains('dropdown-item') && |
| + target != document.activeElement) |
|
Dan Beam
2017/04/04 22:32:00
curlies for this if/else
scottchen
2017/04/04 23:07:27
Done.
|
| + target.focus(); |
| + else |
| + this.focus(); // Blur option focus but keep up/down button working. |
| + }.bind(this), 10); |
| + }, |
| + |
| /** |
| * @param {number} step -1 for getting previous option (up), 1 for getting |
| * next option (down). |