From ffe93cedb284c47170477cecfe26b5a6aedba903 Mon Sep 17 00:00:00 2001 From: "tkent@chromium.org" Date: Wed, 7 Aug 2013 23:57:49 +0000 Subject: [PATCH] Settings: Clear focus if overlay.focus() is not called. Bugs: * Open a setting overlay directly from ominibox (e.g. enter chrome://settings/fonts). The setting search box is still focused and we can enter text to it. * Open do-not-track-confirm overlay or spelling-confirm overlay, switch to antoher tab, then switch back to the settings tab. "Learn More" link is focused unexpectedly. Root cause: A change to options_page.js [1] was incomplete. We should remove focus anyway even if there are no keyboard-focused elements. [1] http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/resources/options/options_page.js?r1=214614&r2=214613&pathrev=214614 BUG=267400,268796 Review URL: https://chromiumcodereview.appspot.com/22342004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216322 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/resources/options/options_page.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index 025eba044b14..67fbe2ff49f6 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -277,11 +277,15 @@ cr.define('options', function() { this.setTitle_(overlay.title); // Change focus to the overlay if any other control was focused by keyboard - // before. - if (document.activeElement != document.body && - document.documentElement.classList.contains( - cr.ui.FocusOutlineManager.CLASS_NAME)) - overlay.focus(); + // before. Otherwise, no one should have focus. + if (document.activeElement != document.body) { + if (document.documentElement.classList.contains( + cr.ui.FocusOutlineManager.CLASS_NAME)) { + overlay.focus(); + } else { + document.activeElement.blur(); + } + } $('searchBox').setAttribute('aria-hidden', true); -- 2.11.4.GIT