Commit fd1d5501 authored by Erik Luo's avatar Erik Luo Committed by Commit Bot

DevTools: prevent tab focus for console objects

Focused Objects in Console will now have tabIndex -1 instead of 0.

Bug: 865674
Change-Id: I382576e1b5ec5ca0bc1c62b8ff0d998c73b18474
Reviewed-on: https://chromium-review.googlesource.com/c/1275266
Commit-Queue: Erik Luo <luoe@chromium.org>
Reviewed-by: default avatarJoel Einbinder <einbinder@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605123}
parent be7a7e64
......@@ -613,6 +613,7 @@ Console.ConsoleViewMessage = class {
const section = new ObjectUI.ObjectPropertiesSection(obj, titleElement, this._linkifier);
section.element.classList.add('console-view-object-properties-section');
section.enableContextMenu();
section.setShowSelectionOnKeyboardFocus(true, true);
this._treeOutlines.push(section);
return section.element;
}
......
......@@ -1596,7 +1596,7 @@ Elements.ElementsTreeOutline.Renderer = class {
treeOutline._element.classList.add('single-node');
treeOutline.setVisible(true);
treeOutline.element.treeElementForTest = treeOutline.firstChild();
treeOutline.setShowSelectionOnKeyboardFocus(true);
treeOutline.setShowSelectionOnKeyboardFocus(true, true);
resolve({node: treeOutline.element, tree: treeOutline});
}
}
......
......@@ -43,6 +43,7 @@ UI.TreeOutline = class extends Common.Object {
this.contentElement = this._rootElement._childrenListNode;
this.contentElement.addEventListener('keydown', this._treeKeyDown.bind(this), false);
this._preventTabOrder = false;
this._showSelectionOnKeyboardFocus = false;
this._focusable = true;
this.setFocusable(this._focusable);
......@@ -54,9 +55,11 @@ UI.TreeOutline = class extends Common.Object {
/**
* @param {boolean} show
* @param {boolean=} preventTabOrder
*/
setShowSelectionOnKeyboardFocus(show) {
setShowSelectionOnKeyboardFocus(show, preventTabOrder) {
this.contentElement.classList.toggle('hide-selection-when-blurred', show);
this._preventTabOrder = !!preventTabOrder;
this._showSelectionOnKeyboardFocus = show;
}
......@@ -1072,7 +1075,7 @@ UI.TreeElement = class {
*/
_setFocusable(focusable) {
if (focusable) {
this._listItemNode.setAttribute('tabIndex', 0);
this._listItemNode.setAttribute('tabIndex', this.treeOutline && this.treeOutline._preventTabOrder ? -1 : 0);
this._listItemNode.addEventListener('focus', this._boundOnFocus, false);
this._listItemNode.addEventListener('blur', this._boundOnBlur, false);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment