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

Side by Side Diff: chrome/browser/resources/options/browser_options.js

Issue 727303005: options: Fix focus "Show advanced settings..." click focus regression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hacky-- Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.exportPath('options'); 5 cr.exportPath('options');
6 6
7 /** 7 /**
8 * @typedef {{actionLinkText: (string|undefined), 8 * @typedef {{actionLinkText: (string|undefined),
9 * hasError: (boolean|undefined), 9 * hasError: (boolean|undefined),
10 * hasUnrecoverableError: (boolean|undefined), 10 * hasUnrecoverableError: (boolean|undefined),
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 // Ensure that navigation events are unblocked on uber page. A reload of 111 // Ensure that navigation events are unblocked on uber page. A reload of
112 // the settings page while an overlay is open would otherwise leave uber 112 // the settings page while an overlay is open would otherwise leave uber
113 // page in a blocked state, where tab switching is not possible. 113 // page in a blocked state, where tab switching is not possible.
114 uber.invokeMethodOnParent('stopInterceptingEvents'); 114 uber.invokeMethodOnParent('stopInterceptingEvents');
115 115
116 window.addEventListener('message', this.handleWindowMessage_.bind(this)); 116 window.addEventListener('message', this.handleWindowMessage_.bind(this));
117 117
118 if (loadTimeData.getBoolean('allowAdvancedSettings')) { 118 if (loadTimeData.getBoolean('allowAdvancedSettings')) {
119 $('advanced-settings-expander').onclick = function() { 119 $('advanced-settings-expander').onclick = function(e) {
120 var showAdvanced = 120 var showAdvanced =
121 BrowserOptions.shouldShowSection_($('advanced-settings')); 121 BrowserOptions.shouldShowSection_($('advanced-settings'));
122 if (showAdvanced) { 122 if (showAdvanced) {
123 chrome.send('coreOptionsUserMetricsAction', 123 chrome.send('coreOptionsUserMetricsAction',
124 ['Options_ShowAdvancedSettings']); 124 ['Options_ShowAdvancedSettings']);
125 } 125 }
126 self.toggleSectionWithAnimation_( 126 self.toggleSectionWithAnimation_(
127 $('advanced-settings'), 127 $('advanced-settings'),
128 $('advanced-settings-container')); 128 $('advanced-settings-container'));
129 129
130 // If the link was focused (i.e., it was activated using the keyboard) 130 // If the click was triggered using the keyboard and it showed the
131 // and it was used to show the section (rather than hiding it), focus 131 // section (rather than hiding it), focus the first element in the
132 // the first element in the container. 132 // container.
133 if (document.activeElement === $('advanced-settings-expander') && 133 if (e.detail == 0 && showAdvanced) {
134 showAdvanced) {
135 var focusElement = $('advanced-settings-container').querySelector( 134 var focusElement = $('advanced-settings-container').querySelector(
136 'button, input, list, select, a[href]'); 135 'button, input, list, select, a[href]');
137 if (focusElement) 136 if (focusElement)
138 focusElement.focus(); 137 focusElement.focus();
139 } 138 }
140 }; 139 };
141 } else { 140 } else {
142 $('advanced-settings-expander').hidden = true; 141 $('advanced-settings-expander').hidden = true;
143 $('advanced-settings').hidden = true; 142 $('advanced-settings').hidden = true;
144 } 143 }
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 } 2173 }
2175 button.textContent = loadTimeData.getString(strId); 2174 button.textContent = loadTimeData.getString(strId);
2176 }; 2175 };
2177 } 2176 }
2178 2177
2179 // Export 2178 // Export
2180 return { 2179 return {
2181 BrowserOptions: BrowserOptions 2180 BrowserOptions: BrowserOptions
2182 }; 2181 };
2183 }); 2182 });
OLDNEW
« 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