Chromium Code Reviews| Index: chrome/browser/resources/options/browser_options.js |
| diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js |
| index c92fa1df42bc7c5c4bc0e7ca50512076fd3a49ad..b8c0dd5776f67e23628108d78e49b3936b1b1c77 100644 |
| --- a/chrome/browser/resources/options/browser_options.js |
| +++ b/chrome/browser/resources/options/browser_options.js |
| @@ -116,7 +116,7 @@ cr.define('options', function() { |
| window.addEventListener('message', this.handleWindowMessage_.bind(this)); |
| if (loadTimeData.getBoolean('allowAdvancedSettings')) { |
| - $('advanced-settings-expander').onclick = function() { |
| + $('advanced-settings-expander').onclick = function(e) { |
| var showAdvanced = |
| BrowserOptions.shouldShowSection_($('advanced-settings')); |
| if (showAdvanced) { |
| @@ -127,11 +127,10 @@ cr.define('options', function() { |
| $('advanced-settings'), |
| $('advanced-settings-container')); |
| - // If the link was focused (i.e., it was activated using the keyboard) |
| - // and it was used to show the section (rather than hiding it), focus |
| - // the first element in the container. |
| - if (document.activeElement === $('advanced-settings-expander') && |
|
Dan Beam
2014/11/18 03:35:38
mousedown can call .focus() so this wasn't particu
|
| - showAdvanced) { |
| + // If the click was triggered using the keyboard and it showed the |
| + // section (rather than hiding it), focus the first element in the |
| + // container. |
| + if (!e.x && showAdvanced) { |
|
Dan Beam
2014/11/18 03:35:37
it's possible e.x != 0 in the future when pressing
|
| var focusElement = $('advanced-settings-container').querySelector( |
| 'button, input, list, select, a[href]'); |
| if (focusElement) |