| 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.
|
|
|