From 866157d312f17830802e04c61b25c25467823156 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 20 Jul 2023 13:58:41 -0700 Subject: [PATCH] Implement CloseWatcher integration for popovers This is being integrated in this HTML spec PR which adds CloseWatchers: https://github.com/whatwg/html/pull/9462 CloseWatcher is not enabled right now, so this patch should not make any behavior changes to stable chrome. This patch makes it so that pressing the escape key uses the document/window's closewatcher stack to find a popover to light dismiss rather than HandlePopoverLightDismiss hiding whatever the TopmostPopoverOrHint is. Hopefully they agree with each other. The behavior change for popovers is that the android back button can close popovers, and this gives popovers the grouping-without-user-activation behavior that dialogs have (with the flag enabled). If you open 5 popovers with a single user activation, then any close signal (including Esc on desktop) will close all 5 of those popovers, not just the topmost one. Bug: 1171318 Change-Id: I73740c3eb9c16b0883862ae259be4867b824a79c --- ...pover-closewatcher-multiple-plus-free.html | 44 +++++++++++++ close-watcher/popover-closewatcher.html | 65 +++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 close-watcher/popover-closewatcher-multiple-plus-free.html create mode 100644 close-watcher/popover-closewatcher.html diff --git a/close-watcher/popover-closewatcher-multiple-plus-free.html b/close-watcher/popover-closewatcher-multiple-plus-free.html new file mode 100644 index 00000000000000..2982e29e264fa2 --- /dev/null +++ b/close-watcher/popover-closewatcher-multiple-plus-free.html @@ -0,0 +1,44 @@ + + + + + + + + + + + +
+ + +
+ + +
p3
+
+
+ + diff --git a/close-watcher/popover-closewatcher.html b/close-watcher/popover-closewatcher.html new file mode 100644 index 00000000000000..6695f2bc4912c8 --- /dev/null +++ b/close-watcher/popover-closewatcher.html @@ -0,0 +1,65 @@ + + + + + + + + + + + +
+ + +
+ + +
p3
+
+
+ +