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

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

Issue 2741863002: DevTools: Focus background in Toolbars (Closed)
Patch Set: clean up code 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 5cfac2c4c9a3689496688c4d54dca48972265df9..d321167fd8a747107d6053379ca1a7fea16492c5 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});
};
/**
@@ -1183,6 +1187,10 @@ 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('focus', UI._focusChanged.bind(UI), true);
+ document.addEventListener('keydown', event => {
+ UI._keyboardFocus = true;
+ document.defaultView.requestAnimationFrame(() => UI._keyboardFocus = false);
+ }, true);
if (!UI.themeSupport)
UI.themeSupport = new UI.ThemeSupport(themeSetting);
@@ -1371,14 +1379,6 @@ UI.CheckboxLabel = class extends HTMLLabelElement {
this.checkboxElement.classList.add('dt-checkbox-themed');
this.checkboxElement.style.borderColor = color;
}
-
- /**
- * @param {boolean} focus
- * @this {Element}
- */
- set visualizeFocus(focus) {
- this.checkboxElement.classList.toggle('dt-checkbox-visualize-focus', focus);
- }
};
(function() {

Powered by Google App Engine
This is Rietveld 408576698