OLD | NEW |
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 /** | 5 /** |
6 * @fileoverview Out of the box experience flow (OOBE). | 6 * @fileoverview Out of the box experience flow (OOBE). |
7 * This is the main code for the OOBE WebUI implementation. | 7 * This is the main code for the OOBE WebUI implementation. |
8 */ | 8 */ |
9 | 9 |
10 // <include src="login_shared.js"> | 10 // <include src="login_shared.js"> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 $('high-contrast').addEventListener('click', | 169 $('high-contrast').addEventListener('click', |
170 Oobe.handleHighContrastClick); | 170 Oobe.handleHighContrastClick); |
171 $('large-cursor').addEventListener('click', | 171 $('large-cursor').addEventListener('click', |
172 Oobe.handleLargeCursorClick); | 172 Oobe.handleLargeCursorClick); |
173 $('spoken-feedback').addEventListener('click', | 173 $('spoken-feedback').addEventListener('click', |
174 Oobe.handleSpokenFeedbackClick); | 174 Oobe.handleSpokenFeedbackClick); |
175 $('screen-magnifier').addEventListener('click', | 175 $('screen-magnifier').addEventListener('click', |
176 Oobe.handleScreenMagnifierClick); | 176 Oobe.handleScreenMagnifierClick); |
177 $('virtual-keyboard').addEventListener('click', | 177 $('virtual-keyboard').addEventListener('click', |
178 Oobe.handleVirtualKeyboardClick); | 178 Oobe.handleVirtualKeyboardClick); |
| 179 |
| 180 $('high-contrast').addEventListener('keypress', Oobe.handleA11yKeyPress); |
| 181 $('large-cursor').addEventListener('keypress', Oobe.handleA11yKeyPress); |
| 182 $('spoken-feedback') |
| 183 .addEventListener('keypress', Oobe.handleA11yKeyPress); |
| 184 $('screen-magnifier') |
| 185 .addEventListener('keypress', Oobe.handleA11yKeyPress); |
| 186 $('virtual-keyboard') |
| 187 .addEventListener('keypress', Oobe.handleA11yKeyPress); |
179 | 188 |
180 // A11y menu should be accessible i.e. disable autohide on any | 189 // A11y menu should be accessible i.e. disable autohide on any |
181 // keydown or click inside menu. | 190 // keydown or click inside menu. |
182 $('accessibility-menu').hideOnKeyPress = false; | 191 $('accessibility-menu').hideOnKeyPress = false; |
183 $('accessibility-menu').hideOnSelfClick = false; | 192 $('accessibility-menu').hideOnSelfClick = false; |
184 }, | 193 }, |
185 | 194 |
186 /** | 195 /** |
187 * Accessibility link handler. | 196 * Accessibility link handler. |
188 */ | 197 */ |
(...skipping 24 matching lines...) Expand all Loading... |
213 // Update screen falls into this category. Since it doesn't have any | 222 // Update screen falls into this category. Since it doesn't have any |
214 // controls other than a11y link we don't want that link to receive | 223 // controls other than a11y link we don't want that link to receive |
215 // focus when screen is shown i.e. defaultControl is not defined. | 224 // focus when screen is shown i.e. defaultControl is not defined. |
216 // Focus a11y link instead. | 225 // Focus a11y link instead. |
217 $('accessibility-menu').elementToFocusOnHide = e.target; | 226 $('accessibility-menu').elementToFocusOnHide = e.target; |
218 } | 227 } |
219 e.stopPropagation(); | 228 e.stopPropagation(); |
220 }, | 229 }, |
221 | 230 |
222 /** | 231 /** |
| 232 * handle a11y menu checkboxes keypress event by simulating click event. |
| 233 */ |
| 234 handleA11yKeyPress: function(e) { |
| 235 if (e.key != 'Enter') |
| 236 return; |
| 237 |
| 238 if (e.target.tagName != 'INPUT' || e.target.type != 'checkbox') |
| 239 return; |
| 240 |
| 241 // Simulate click on the checkbox. |
| 242 e.target.click() |
| 243 }, |
| 244 |
| 245 /** |
223 * Spoken feedback checkbox handler. | 246 * Spoken feedback checkbox handler. |
224 */ | 247 */ |
225 handleSpokenFeedbackClick: function(e) { | 248 handleSpokenFeedbackClick: function(e) { |
226 chrome.send('enableSpokenFeedback', [$('spoken-feedback').checked]); | 249 chrome.send('enableSpokenFeedback', [$('spoken-feedback').checked]); |
227 e.stopPropagation(); | 250 e.stopPropagation(); |
228 }, | 251 }, |
229 | 252 |
230 /** | 253 /** |
231 * Large cursor checkbox handler. | 254 * Large cursor checkbox handler. |
232 */ | 255 */ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 $('oobe-shield').setAttribute('md-mode', 'true'); | 374 $('oobe-shield').setAttribute('md-mode', 'true'); |
352 $('popup-overlay').setAttribute('md-mode', 'true'); | 375 $('popup-overlay').setAttribute('md-mode', 'true'); |
353 } else { | 376 } else { |
354 $('oobe').removeAttribute('md-mode'); | 377 $('oobe').removeAttribute('md-mode'); |
355 $('oobe-shield').removeAttribute('md-mode'); | 378 $('oobe-shield').removeAttribute('md-mode'); |
356 $('popup-overlay').removeAttribute('md-mode'); | 379 $('popup-overlay').removeAttribute('md-mode'); |
357 } | 380 } |
358 }, | 381 }, |
359 }; | 382 }; |
360 }); | 383 }); |
OLD | NEW |