Commit 2246667e authored by James Cook's avatar James Cook Committed by Commit Bot

settings: Fix focus rings appearing on window blur

FocusOutlineManager considered the document "focused by keyboard" after
window blur. This seems a little odd, and causes the OS settings sidenav
menu to show the keyboard focus ring on window blur.

This FocusOutlineManager behavior was added in 2015, before MD settings.
We don't appear to need it anymore. It was added in:

https://codereview.chromium.org/914033002

and the bug it fixed crbug.com/457165 no longer repros, even after I
remove the behavior. Likewise, browser settings sidenav focus outlines
continue to work properly after removing this behavior (they show after
hitting tab, hide when the window loses focus, and come back when the
window regains focus).

So let's remove the behavior.

Bug: 993677
Change-Id: If9c56ad18d50d0974cf957864c6346ebdffd0470
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1754505Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#687324}
parent 027f3bbb
...@@ -14,8 +14,7 @@ cr.define('cr.ui', function() { ...@@ -14,8 +14,7 @@ cr.define('cr.ui', function() {
/** /**
* This class sets a CSS class name on the HTML element of |doc| when the user * This class sets a CSS class name on the HTML element of |doc| when the user
* presses the tab key. It removes the class name when the user clicks * presses a key. It removes the class name when the user clicks anywhere.
* anywhere.
* *
* This allows you to write CSS like this: * This allows you to write CSS like this:
* *
...@@ -34,7 +33,7 @@ cr.define('cr.ui', function() { ...@@ -34,7 +33,7 @@ cr.define('cr.ui', function() {
*/ */
constructor(doc) { constructor(doc) {
/** /**
* Whether focus change is triggered by TAB key. * Whether focus change is triggered by a keyboard event.
* @private {boolean} * @private {boolean}
*/ */
this.focusByKeyboard_ = true; this.focusByKeyboard_ = true;
...@@ -52,15 +51,6 @@ cr.define('cr.ui', function() { ...@@ -52,15 +51,6 @@ cr.define('cr.ui', function() {
doc.addEventListener('keydown', onEvent.bind(this, true), true); doc.addEventListener('keydown', onEvent.bind(this, true), true);
doc.addEventListener('mousedown', onEvent.bind(this, false), true); doc.addEventListener('mousedown', onEvent.bind(this, false), true);
doc.addEventListener('focusout', event => {
window.setTimeout(() => {
if (!doc.hasFocus()) {
this.focusByKeyboard_ = true;
this.updateVisibility();
}
}, 0);
});
this.updateVisibility(); this.updateVisibility();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment