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

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: experimental debounce 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..8e82b3dff53ce14fe06b6863e58fc2e42d30cc40 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,25 @@ Polymer({
e.preventDefault();
},
+ debounceFlusher_: null,
+
+ onMouseMove_: function(e) {
+ var target = e.target;
+
+ if(!this.debounceFlusher_) {
scottchen 2017/04/04 20:43:12 Need this, otherwise if the user keeps moving thei
+ this.debounceFlusher_ = setTimeout(function(){
+ this.flushDebouncer('cr-action-menu-mousemove');
+ this.debounceFlusher_ = null;
+ }.bind(this), 10);
+ }
+
+ this.debounce('cr-action-menu-mousemove', function(){
+ if(target.classList.contains('dropdown-item') &&
+ target != document.activeElement)
+ target.focus();
+ }.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