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

Unified Diff: tracing/tracing/ui/base/overlay.html

Issue 2946513002: Manage focus in overlays. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/ui/base/overlay.html
diff --git a/tracing/tracing/ui/base/overlay.html b/tracing/tracing/ui/base/overlay.html
index 9a03812b53c5a0da6b24e2dfa142001b011c9533..4f842ca4f71bd47db3d1bae7eb33fe4a79af6ddd 100644
--- a/tracing/tracing/ui/base/overlay.html
+++ b/tracing/tracing/ui/base/overlay.html
@@ -268,8 +268,19 @@ tr.exportTo('tr.ui.b', function() {
},
onFocusIn_(e) {
- if (e.target === this) return;
+ // Prevent focus from leaving the overlay.
+
+ let node = e.target;
+ while (node) {
+ if (node === this) {
+ // |this| contains |e.target|, so nothing needs to be done. Allow
+ // focus to move from |this| to |e.target|.
+ return;
+ }
+ node = node.parentNode;
+ }
+ // |e.target| is outside of |this|, so focus |this|.
tr.b.timeout(0).then(() => this.focus());
e.preventDefault();
e.stopPropagation();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698