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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js

Issue 2829683003: DevTools: Don't lose focus when interacting with ListWidget (Closed)
Patch Set: Focus restorer Created 3 years, 8 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: third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js b/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
index 6a3a19e79b0779cf4c49ae3b795c79aecddc3c12..2d1aa0624a7ea8135cf519e9669950621d5b1cb5 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
@@ -14,6 +14,7 @@ UI.ListWidget = class extends UI.VBox {
this._delegate = delegate;
this._list = this.contentElement.createChild('div', 'list');
+ this.element.tabIndex = -1;
/** @type {?UI.ListWidget.Editor} */
this._editor = null;
@@ -144,6 +145,7 @@ UI.ListWidget = class extends UI.VBox {
*/
function onRemoveClicked() {
var index = this._elements.indexOf(element);
+ this.element.focus();
this._delegate.removeItemRequested(this._items[index], index);
}
}
@@ -176,6 +178,7 @@ UI.ListWidget = class extends UI.VBox {
return;
this._stopEditing();
+ this._focusRestorer = new UI.ElementFocusRestorer(this.element);
this._list.classList.add('list-editing');
this._editItem = item;
@@ -202,6 +205,8 @@ UI.ListWidget = class extends UI.VBox {
_stopEditing() {
this._list.classList.remove('list-editing');
+ if (this._focusRestorer)
+ this._focusRestorer.restore();
if (this._editElement)
this._editElement.classList.remove('hidden');
if (this._editor && this._editor.element.parentElement)
« 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