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

Unified Diff: chrome/browser/resources/print_preview/search/destination_list.js

Issue 2896463004: Print Preview: Mac: Do not blur focused item while opening the hamburger menu. (Closed)
Patch Set: Actually remove a hack for appendChild() Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/search/destination_list.js
diff --git a/chrome/browser/resources/print_preview/search/destination_list.js b/chrome/browser/resources/print_preview/search/destination_list.js
index 9b9647a00bf39eb3414b75b50c2300473f3cf6c5..a668637e0d0bc994cd9bd8fd24e0e78d825eb166 100644
--- a/chrome/browser/resources/print_preview/search/destination_list.js
+++ b/chrome/browser/resources/print_preview/search/destination_list.js
@@ -306,7 +306,10 @@ cr.define('print_preview', function() {
});
// Update the existing items, add the new ones (preserve the focused one).
var listEl = this.getChildElement('.destination-list > ul');
- var focusedEl = listEl.querySelector(':focus');
+ // We need to use activeElement instead of :focus selector, which doesn't
+ // work in an inactive page. See crbug.com/723579.
+ var focusedEl = listEl.contains(document.activeElement) ?
+ document.activeElement : null;
for (var i = 0; i < numItems; i++) {
var destination = assert(destinations[i]);
var listItem = visibleListItems[destination.id];
@@ -332,7 +335,8 @@ cr.define('print_preview', function() {
var itemEl = listItem.getElement();
// Preserve focused inner element, if there's one.
- var focusedInnerEl = focusedEl ? itemEl.querySelector(':focus') : null;
+ var focusedInnerEl = focusedEl && itemEl.contains(focusedEl) ?
+ focusedEl : null;
if (focusedEl)
itemEl.classList.add('moving');
// Move it to the end of the list.
« 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