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

Unified Diff: ui/webui/resources/js/cr/ui/focus_without_ink.js

Issue 2842303004: MD Settings: update dialogs to focus without ink when using mouse (Closed)
Patch Set: merge 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
Index: ui/webui/resources/js/cr/ui/focus_without_ink.js
diff --git a/ui/webui/resources/js/cr/ui/focus_without_ink.js b/ui/webui/resources/js/cr/ui/focus_without_ink.js
new file mode 100644
index 0000000000000000000000000000000000000000..cf91e526ff916be577dcb32f65d482109e2cf5bc
--- /dev/null
+++ b/ui/webui/resources/js/cr/ui/focus_without_ink.js
@@ -0,0 +1,28 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('cr.ui', function() {
+ var outline = cr.ui.FocusOutlineManager.forDocument(document);
+
+ /** @param {Element} toFocus */
+ function focusWithoutInk(toFocus) {
dpapad 2017/04/28 17:36:46 Can you add a short sentence explaining the purpos
Dan Beam 2017/04/29 02:56:31 Done.
+ // TODO(dbeam): assert('noink' in toFocus);
dpapad 2017/04/28 17:36:46 Why not doing this as part of this CL?
Dan Beam 2017/04/29 02:56:31 if we don't merge, i'll add it now. if we do merg
+ // TODO(dbeam): assert(document == toFocus.ownerDocument);
+
+ var origNoInk;
+
+ var hideInk = !outline.visible;
+ if (hideInk) {
+ origNoInk = toFocus.noink;
+ toFocus.noink = true;
+ }
+
+ toFocus.focus();
+
+ if (hideInk)
+ toFocus.noink = origNoInk;
+ }
+
+ return {focusWithoutInk: focusWithoutInk};
+});

Powered by Google App Engine
This is Rietveld 408576698