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 <include src="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> | 5 <include src="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> |
6 <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> | 6 <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> |
7 <include src="../uber/uber_utils.js"> | 7 <include src="../uber/uber_utils.js"> |
8 <include src="extension_code.js"> | 8 <include src="extension_code.js"> |
9 <include src="extension_commands_overlay.js"> | 9 <include src="extension_commands_overlay.js"> |
10 <include src="extension_error_overlay.js"> | 10 <include src="extension_error_overlay.js"> |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 document.body.classList.toggle('no-scroll', !!node); | 379 document.body.classList.toggle('no-scroll', !!node); |
380 | 380 |
381 var currentlyShowingOverlay = ExtensionSettings.getCurrentOverlay(); | 381 var currentlyShowingOverlay = ExtensionSettings.getCurrentOverlay(); |
382 if (currentlyShowingOverlay) { | 382 if (currentlyShowingOverlay) { |
383 if (currentlyShowingOverlay == node) // Already displayed. | 383 if (currentlyShowingOverlay == node) // Already displayed. |
384 return; | 384 return; |
385 currentlyShowingOverlay.classList.remove('showing'); | 385 currentlyShowingOverlay.classList.remove('showing'); |
386 } | 386 } |
387 | 387 |
388 if (node) { | 388 if (node) { |
389 var lastFocused = document.activeElement; | 389 var lastFocused; |
| 390 |
| 391 var focusOutlineManager = cr.ui.FocusOutlineManager.forDocument(document); |
| 392 if (focusOutlineManager.visible) |
| 393 lastFocused = document.activeElement; |
| 394 |
390 $('overlay').addEventListener('cancelOverlay', function f() { | 395 $('overlay').addEventListener('cancelOverlay', function f() { |
391 lastFocused.focus(); | 396 if (lastFocused && focusOutlineManager.visible) |
| 397 lastFocused.focus(); |
| 398 |
392 $('overlay').removeEventListener('cancelOverlay', f); | 399 $('overlay').removeEventListener('cancelOverlay', f); |
393 }); | 400 }); |
394 node.classList.add('showing'); | 401 node.classList.add('showing'); |
395 } | 402 } |
396 | 403 |
397 var pages = document.querySelectorAll('.page'); | 404 var pages = document.querySelectorAll('.page'); |
398 for (var i = 0; i < pages.length; i++) { | 405 for (var i = 0; i < pages.length; i++) { |
399 pages[i].setAttribute('aria-hidden', node ? 'true' : 'false'); | 406 pages[i].setAttribute('aria-hidden', node ? 'true' : 'false'); |
400 } | 407 } |
401 | 408 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 // Export | 471 // Export |
465 return { | 472 return { |
466 ExtensionSettings: ExtensionSettings | 473 ExtensionSettings: ExtensionSettings |
467 }; | 474 }; |
468 }); | 475 }); |
469 | 476 |
470 window.addEventListener('load', function(e) { | 477 window.addEventListener('load', function(e) { |
471 document.documentElement.classList.add('loading'); | 478 document.documentElement.classList.add('loading'); |
472 extensions.ExtensionSettings.getInstance().initialize(); | 479 extensions.ExtensionSettings.getInstance().initialize(); |
473 }); | 480 }); |
OLD | NEW |