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

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

Issue 2741863002: DevTools: Focus background in Toolbars (Closed)
Patch Set: remove host-context Created 3 years, 9 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
Index: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
index ad82daf5eb7a579c37c2189075c0ae230aa3ebc9..ef53ffea6a4ab3fcfb4e461fa00dede13187a46d 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -785,6 +785,10 @@ UI._focusChanged = function(event) {
var document = event.target && event.target.ownerDocument;
var element = document ? document.deepActiveElement() : null;
UI.Widget.focusWidgetForNode(element);
+ if (!UI._keyboardFocus)
+ return;
+ element.setAttribute('data-keyboard-focus', 'true');
+ element.addEventListener('blur', () => element.removeAttribute('data-keyboard-focus'), {once: true, capture: true});
};
/**
@@ -1182,6 +1186,10 @@ UI.LongClickController = class extends Common.Object {
UI.initializeUIUtils = function(document, themeSetting) {
document.defaultView.addEventListener('focus', UI._windowFocused.bind(UI, document), false);
document.defaultView.addEventListener('blur', UI._windowBlurred.bind(UI, document), false);
+ document.addEventListener('keydown', event => {
+ UI._keyboardFocus = true;
+ document.defaultView.requestAnimationFrame(() => UI._keyboardFocus = false);
+ }, true);
document.addEventListener('focus', UI._focusChanged.bind(UI), true);
if (!UI.themeSupport)
@@ -1413,14 +1421,6 @@ UI.appendStyle = function(node, cssFile) {
this.checkboxElement.style.borderColor = color;
},
- /**
- * @param {boolean} focus
- * @this {Element}
- */
- set visualizeFocus(focus) {
- this.checkboxElement.classList.toggle('dt-checkbox-visualize-focus', focus);
- },
-
__proto__: HTMLLabelElement.prototype
});

Powered by Google App Engine
This is Rietveld 408576698