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

Unified Diff: ui/webui/resources/js/cr/ui/focus_outline_manager.js

Issue 914033002: uber: remove mouse focus outlines on nav tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asdf Created 5 years, 10 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 | « chrome/browser/resources/uber/uber_frame.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/focus_outline_manager.js
diff --git a/ui/webui/resources/js/cr/ui/focus_outline_manager.js b/ui/webui/resources/js/cr/ui/focus_outline_manager.js
index 7f921ab5e6cec7998fbd5d3ecac4a87e40f9ae4e..df8dadc24ecc2d3ab0eb6b244d372908cea1ffda 100644
--- a/ui/webui/resources/js/cr/ui/focus_outline_manager.js
+++ b/ui/webui/resources/js/cr/ui/focus_outline_manager.js
@@ -3,7 +3,6 @@
// found in the LICENSE file.
cr.define('cr.ui', function() {
-
/**
* The class name to set on the document element.
* @const
@@ -29,10 +28,11 @@ cr.define('cr.ui', function() {
*/
function FocusOutlineManager(doc) {
this.classList_ = doc.documentElement.classList;
+
var self = this;
+
doc.addEventListener('keydown', function(e) {
- if (e.keyCode == 9) // Tab
- self.focusByKeyboard_ = true;
+ self.focusByKeyboard_ = true;
}, true);
doc.addEventListener('mousedown', function(e) {
@@ -41,8 +41,19 @@ cr.define('cr.ui', function() {
doc.addEventListener('focus', function(event) {
// Update visibility only when focus is actually changed.
- self.visible = self.focusByKeyboard_;
+ self.updateVisiblity_();
}, true);
+
+ doc.addEventListener('focusout', function(event) {
+ window.setTimeout(function() {
+ if (!doc.hasFocus()) {
+ self.focusByKeyboard_ = true;
+ self.updateVisiblity_();
+ }
+ }, 0);
+ });
+
+ this.updateVisiblity_();
}
FocusOutlineManager.prototype = {
@@ -53,6 +64,11 @@ cr.define('cr.ui', function() {
*/
focusByKeyboard_: true,
+ /** @private */
+ updateVisiblity_: function() {
+ this.visible = this.focusByKeyboard_;
+ },
+
/**
* Whether the focus outline should be visible.
* @type {boolean}
« no previous file with comments | « chrome/browser/resources/uber/uber_frame.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698