Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js

Issue 2801453002: MD Settings: mouse movements should focus cr-action-menu items (Closed)
Patch Set: mimic context menu on mouse out Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698