Bug 1424469 - The Downloads view in the Library window doesn't get focus when opened. r=mak

We have to keep track of the focused element while we remove the richlistbox element temporarily.

MozReview-Commit-ID: AePydUyyUS7

--HG--
extra : rebase_source : 1dbab87a07a4d95780e0abf29efec94ea73344cf
extra : amend_source : 6e685a648e0ba674eba791e1dc7138f67bd7f1e0
This commit is contained in:
Paolo Amadini 2018-01-30 14:38:25 +00:00
Родитель 50b08d7ef3
Коммит d5882582e3
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -429,11 +429,15 @@ DownloadsPlacesView.prototype = {
xblFields.set(key, value);
}
let oldActiveElement = document.activeElement;
let parentNode = this._richlistbox.parentNode;
let nextSibling = this._richlistbox.nextSibling;
parentNode.removeChild(this._richlistbox);
this._richlistbox.prepend(this.batchFragment);
parentNode.insertBefore(this._richlistbox, nextSibling);
if (oldActiveElement && oldActiveElement != document.activeElement) {
oldActiveElement.focus();
}
for (let [key, value] of xblFields) {
this._richlistbox[key] = value;