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

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

Issue 2741863002: DevTools: Focus background in Toolbars (Closed)
Patch Set: raf 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 edef86920d8e16ca16ecc22b440b22ee97bff2a4..624a8df4121f19fb56c793a137fd3290ea7312b1 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -784,6 +784,8 @@ UI._windowBlurred = function(document, event) {
UI._focusChanged = function(event) {
var document = event.target && event.target.ownerDocument;
var element = document ? document.deepActiveElement() : null;
+ if (document && document.body)
+ document.body.classList.toggle('keyboard-focus', UI._keyboardFocus);
pfeldman 2017/03/27 21:17:35 What is this about?
einbinder 2017/03/27 23:12:59 To distinguish between tabbing into an element vs
pfeldman 2017/03/28 17:44:35 Somehow I don't like storing the 'last focus was g
UI.Widget.focusWidgetForNode(element);
};
@@ -1182,6 +1184,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);
pfeldman 2017/03/27 21:17:35 Seems like technical debt.
einbinder 2017/03/27 23:12:59 It is a hack, but it felt like the cleanest hack.
pfeldman 2017/03/28 03:23:38 Let me try to narrate this code: - every time key
einbinder 2017/03/28 08:28:39 The keyboard-focus class stays on until the focus
pfeldman 2017/03/28 17:44:35 This blurs the contract you are introducing. Code
+ }, true);
document.addEventListener('focus', UI._focusChanged.bind(UI), true);
if (!UI.themeSupport)
@@ -1413,14 +1419,6 @@ UI.appendStyle = function(node, cssFile) {
this.checkboxElement.style.borderColor = color;
},
- /**
- * @param {boolean} focus
- * @this {Element}
- */
- set visualizeFocus(focus) {
einbinder 2017/03/14 09:14:36 This was used to selectively add focus rings to ch
- this.checkboxElement.classList.toggle('dt-checkbox-visualize-focus', focus);
- },
-
__proto__: HTMLLabelElement.prototype
});

Powered by Google App Engine
This is Rietveld 408576698