(In reply to Emilio Cobos Álvarez (:emilio) from comment #2) > IgnoreKeys and co generally only seem to work on `<menupopup>`, not on `<panel>` (and that seems somewhat intentional by reading the code). > > That said Esc is handled everywhere. Esc for panels should be handled [here](https://searchfox.org/mozilla-central/rev/2a69486ab1df00b1ea8ecd14027e2cc6c0415ed0/layout/xul/nsXULPopupManager.cpp#2541). Can you check if that's reached with the popup you care about? It might be that something has prevented the propagation of the event earlier or so... The event listener is a regular capturing event listener on the relevant `document`. Thanks, that seems reasonable. Here's what I did: ```diff --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -19,6 +19,7 @@ #include "nsCSSFrameConstructor.h" #include "nsGlobalWindowOuter.h" #include "nsIContentInlines.h" +#include "nsIConsoleService.h" #include "nsLayoutUtils.h" #include "nsViewManager.h" #include "nsITimer.h" @@ -1258,6 +1259,15 @@ void nsXULPopupManager::HidePopup(Element* aPopup, HidePopupOptions aOptions, if (foundPopup) { if (foundPopup->IsNoAutoHide()) { + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + nsAtom* idAtom = aPopup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Hiding popup "_ns + NS_ConvertUTF8toUTF16(id)).get()); + } // If this is a noautohide panel, remove it but don't close any other // panels. popupToHide = aPopup; @@ -2539,9 +2549,30 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode( uint32_t keyCode = aKeyEvent->KeyCode(); // Escape should close panels, but the other keys should have no effect. + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Handling keyboard event for popup "_ns + + NS_ConvertUTF8toUTF16(id)) + .get()); + } if (aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu) { if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) { + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Maybe hiding popup "_ns + NS_ConvertUTF8toUTF16(id)) + .get()); + } HidePopup(aTopVisibleMenuItem->Element(), {HidePopupOption::IsRollup}); aKeyEvent->StopPropagation(); aKeyEvent->StopCrossProcessForwarding(); ``` So I created 3 console messages. *Message 1* is when the keyboard event is handled. *Message 2* is when Esc specifically is handled and the popup passes the `aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu` check. *Message 3* is when `nsXULPopupManager::HidePopup` is invoked and the popup passes the `foundPopup->IsNoAutoHide()` check. When `noautohide` is _disabled_, I see Message 1 and Message 2, but not Message 3, and the panel is indeed closed. The event never reaches [my custom handler](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#1754) in this case. When `noautohide` is _enabled_, I see none of the 3 messages, and the panel is not closed. The event does reach my handler, but because it's [not focused](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#333-343), the panel is not dismissed. Of course, we could eliminate that focus check. But we intend to get rid of this custom handler altogether, and bring the callout panel more in line with the rest of the browser. We've heard from Jamie Teh that panel autofocus behavior is going to be disabled by default, so we basically want to remove all the custom handling and let the panel be dismissed on Esc by whatever logic will do that for other, more normal panels. So, I'm not sure why `noautohide` would prevent all 3 messages from being reached. It is checked before Message 3, but I don't see any `noautohide` checks upstream of Messages 1 and 2. Here's the relevant markup of the panel, once it's shown: ```html <panel class="panel-no-padding" orient="vertical" noautofocus="true" flip="slide" type="arrow" consumeoutsideclicks="never" norolluponanchor="true" position="bottomcenter topright" show-arrow="" noautohide="true" id="feature-callout" aria-describedby="#feature-callout .welcome-text" side="top" hasbeenopened="true" animate="open" arrow-position="top-end" panelopen="true" /> ```
Bug 1950194 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2) > IgnoreKeys and co generally only seem to work on `<menupopup>`, not on `<panel>` (and that seems somewhat intentional by reading the code). > > That said Esc is handled everywhere. Esc for panels should be handled [here](https://searchfox.org/mozilla-central/rev/2a69486ab1df00b1ea8ecd14027e2cc6c0415ed0/layout/xul/nsXULPopupManager.cpp#2541). Can you check if that's reached with the popup you care about? It might be that something has prevented the propagation of the event earlier or so... The event listener is a regular capturing event listener on the relevant `document`. Thanks, that seems reasonable. Here's what I did: ```diff --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -19,6 +19,7 @@ #include "nsCSSFrameConstructor.h" #include "nsGlobalWindowOuter.h" #include "nsIContentInlines.h" +#include "nsIConsoleService.h" #include "nsLayoutUtils.h" #include "nsViewManager.h" #include "nsITimer.h" @@ -1258,6 +1259,15 @@ void nsXULPopupManager::HidePopup(Element* aPopup, HidePopupOptions aOptions, if (foundPopup) { if (foundPopup->IsNoAutoHide()) { + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + nsAtom* idAtom = aPopup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Hiding popup "_ns + NS_ConvertUTF8toUTF16(id)).get()); + } // If this is a noautohide panel, remove it but don't close any other // panels. popupToHide = aPopup; @@ -2539,9 +2549,30 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode( uint32_t keyCode = aKeyEvent->KeyCode(); // Escape should close panels, but the other keys should have no effect. + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Handling keyboard event for popup "_ns + + NS_ConvertUTF8toUTF16(id)) + .get()); + } if (aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu) { if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) { + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Maybe hiding popup "_ns + NS_ConvertUTF8toUTF16(id)) + .get()); + } HidePopup(aTopVisibleMenuItem->Element(), {HidePopupOption::IsRollup}); aKeyEvent->StopPropagation(); aKeyEvent->StopCrossProcessForwarding(); ``` So I created 3 console messages. *Message 1* is when the keyboard event is handled. *Message 2* is when Esc specifically is handled and the popup passes the `aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu` check. *Message 3* is when `nsXULPopupManager::HidePopup` is invoked and the popup passes the `foundPopup->IsNoAutoHide()` check. When `noautohide` is _disabled_, I see Message 1 and Message 2, but not Message 3, and the panel is indeed closed. The event never reaches [my custom handler](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#1754) in this case. When `noautohide` is _enabled_, I see none of the 3 messages, and the panel is not closed. The event does reach my handler, but because it's [not focused](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#333-343), the panel is not dismissed. Of course, we could eliminate that focus check. But we intend to get rid of this custom handler altogether, and bring the callout panel more in line with the rest of the browser. We've heard from Jamie Teh that panel autofocus behavior is going to be disabled by default, so we basically want to remove all the custom handling and let the panel be dismissed on Esc by whatever logic will do that for other, more normal panels. So, I'm not sure why `noautohide` would prevent all 3 messages from being reached. It is checked before Message 3, but I don't see any `noautohide` checks upstream of Messages 1 and 2. Here's the relevant markup of the panel, once it's shown: ```html <panel class="panel-no-padding" orient="vertical" noautofocus="true" flip="slide" type="arrow" consumeoutsideclicks="never" norolluponanchor="true" position="bottomcenter topright" show-arrow="" noautohide="true" id="feature-callout" aria-describedby="#feature-callout .welcome-text" side="top" hasbeenopened="true" animate="open" arrow-position="top-end" panelopen="true" /> ``` Oh, and just to be clear, if I click inside the `noautohide` panel and _then_ hit Escape, it shows Message 3, but not Messages 1 and 2.
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2) > IgnoreKeys and co generally only seem to work on `<menupopup>`, not on `<panel>` (and that seems somewhat intentional by reading the code). > > That said Esc is handled everywhere. Esc for panels should be handled [here](https://searchfox.org/mozilla-central/rev/2a69486ab1df00b1ea8ecd14027e2cc6c0415ed0/layout/xul/nsXULPopupManager.cpp#2541). Can you check if that's reached with the popup you care about? It might be that something has prevented the propagation of the event earlier or so... The event listener is a regular capturing event listener on the relevant `document`. Thanks, that seems reasonable. Here's what I did: ```diff --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -19,6 +19,7 @@ #include "nsCSSFrameConstructor.h" #include "nsGlobalWindowOuter.h" #include "nsIContentInlines.h" +#include "nsIConsoleService.h" #include "nsLayoutUtils.h" #include "nsViewManager.h" #include "nsITimer.h" @@ -1258,6 +1259,15 @@ void nsXULPopupManager::HidePopup(Element* aPopup, HidePopupOptions aOptions, if (foundPopup) { if (foundPopup->IsNoAutoHide()) { + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + nsAtom* idAtom = aPopup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Hiding popup "_ns + NS_ConvertUTF8toUTF16(id)).get()); + } // If this is a noautohide panel, remove it but don't close any other // panels. popupToHide = aPopup; @@ -2539,9 +2549,30 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode( uint32_t keyCode = aKeyEvent->KeyCode(); // Escape should close panels, but the other keys should have no effect. + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Handling keyboard event for popup "_ns + + NS_ConvertUTF8toUTF16(id)) + .get()); + } if (aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu) { if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) { + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Maybe hiding popup "_ns + NS_ConvertUTF8toUTF16(id)) + .get()); + } HidePopup(aTopVisibleMenuItem->Element(), {HidePopupOption::IsRollup}); aKeyEvent->StopPropagation(); aKeyEvent->StopCrossProcessForwarding(); ``` So I created 3 console messages. *Message 1* is when the keyboard event is handled. *Message 2* is when Esc specifically is handled and the popup passes the `aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu` check. *Message 3* is when `nsXULPopupManager::HidePopup` is invoked and the popup passes the `foundPopup->IsNoAutoHide()` check. When `noautohide` is _disabled_, I see Message 1 and Message 2, but not Message 3, and the panel is indeed closed. The event never reaches [my custom handler](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#1754) in this case. When `noautohide` is _enabled_, I see none of the 3 messages, and the panel is not closed. The event does reach my handler, but because it's [not focused](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#333-343), the panel is not dismissed. Of course, we could eliminate that focus check. But we intend to get rid of this custom handler altogether, and bring the callout panel more in line with the rest of the browser. We've heard from Jamie Teh that panel autofocus behavior is going to be disabled by default, so we basically want to remove all the custom handling and let the panel be dismissed on Esc by whatever logic will do that for other, more normal panels. So, I'm not sure why `noautohide` would prevent all 3 messages from being reached. It is checked before Message 3, but I don't see any `noautohide` checks upstream of Messages 1 and 2. Here's the relevant markup of the panel, once it's shown: ```html <panel class="panel-no-padding" orient="vertical" noautofocus="true" flip="slide" type="arrow" consumeoutsideclicks="never" norolluponanchor="true" position="bottomcenter topright" show-arrow="" noautohide="true" id="feature-callout" aria-describedby="#feature-callout .welcome-text" side="top" hasbeenopened="true" animate="open" arrow-position="top-end" panelopen="true" /> ``` Oh, and just to be clear, if I click inside the `noautohide` panel and _then_ hit Escape, it shows Message 3, but not Messages 1 and 2. This seems to be because that custom handler I mentioned previously is calling `hidePopup()`, confirmed by breakpoints. So it seems like the XULPopupManager event listener is not picking up the keypress.
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2) > IgnoreKeys and co generally only seem to work on `<menupopup>`, not on `<panel>` (and that seems somewhat intentional by reading the code). > > That said Esc is handled everywhere. Esc for panels should be handled [here](https://searchfox.org/mozilla-central/rev/2a69486ab1df00b1ea8ecd14027e2cc6c0415ed0/layout/xul/nsXULPopupManager.cpp#2541). Can you check if that's reached with the popup you care about? It might be that something has prevented the propagation of the event earlier or so... The event listener is a regular capturing event listener on the relevant `document`. Thanks, that seems reasonable. Here's what I did: ```diff --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -19,6 +19,7 @@ #include "nsCSSFrameConstructor.h" #include "nsGlobalWindowOuter.h" #include "nsIContentInlines.h" +#include "nsIConsoleService.h" #include "nsLayoutUtils.h" #include "nsViewManager.h" #include "nsITimer.h" @@ -1258,6 +1259,15 @@ void nsXULPopupManager::HidePopup(Element* aPopup, HidePopupOptions aOptions, if (foundPopup) { if (foundPopup->IsNoAutoHide()) { + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + nsAtom* idAtom = aPopup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Hiding popup "_ns + NS_ConvertUTF8toUTF16(id)).get()); + } // If this is a noautohide panel, remove it but don't close any other // panels. popupToHide = aPopup; @@ -2539,9 +2549,30 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode( uint32_t keyCode = aKeyEvent->KeyCode(); // Escape should close panels, but the other keys should have no effect. + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Handling keyboard event for popup "_ns + + NS_ConvertUTF8toUTF16(id)) + .get()); + } if (aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu) { if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) { + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Maybe hiding popup "_ns + NS_ConvertUTF8toUTF16(id)) + .get()); + } HidePopup(aTopVisibleMenuItem->Element(), {HidePopupOption::IsRollup}); aKeyEvent->StopPropagation(); aKeyEvent->StopCrossProcessForwarding(); ``` So I created 3 console messages. *Message 1* is when the keyboard event is handled. *Message 2* is when Esc specifically is handled and the popup passes the `aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu` check. *Message 3* is when `nsXULPopupManager::HidePopup` is invoked and the popup passes the `foundPopup->IsNoAutoHide()` check. When `noautohide` is _disabled_, I see Message 1 and Message 2, but not Message 3, and the panel is indeed closed. The event never reaches [my custom handler](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#1754) in this case. When `noautohide` is _enabled_, I see none of the 3 messages, and the panel is not closed. The event does reach my handler, but because it's [not focused](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#333-343), the panel is not dismissed. Of course, we could eliminate that focus check. But we intend to get rid of this custom handler altogether, and bring the callout panel more in line with the rest of the browser. We've heard from Jamie Teh that panel autofocus behavior is going to be disabled by default, so we basically want to remove all the custom handling and let the panel be dismissed on Esc by whatever logic will do that for other, more normal panels. Probably wise to not reinvent the wheel anyway, if there's already much lower-level logic for when to handle e.g. an Esc keypress that bubbles up from within a tabbed browser. So, I'm not sure why `noautohide` would prevent all 3 messages from being reached. It is checked before Message 3, but I don't see any `noautohide` checks upstream of Messages 1 and 2. Here's the relevant markup of the panel, once it's shown: ```html <panel class="panel-no-padding" orient="vertical" noautofocus="true" flip="slide" type="arrow" consumeoutsideclicks="never" norolluponanchor="true" position="bottomcenter topright" show-arrow="" noautohide="true" id="feature-callout" aria-describedby="#feature-callout .welcome-text" side="top" hasbeenopened="true" animate="open" arrow-position="top-end" panelopen="true" /> ``` Oh, and just to be clear, if I click inside the `noautohide` panel and _then_ hit Escape, it shows Message 3, but not Messages 1 and 2. This seems to be because that custom handler I mentioned previously is calling `hidePopup()`, confirmed by breakpoints. So it seems like the XULPopupManager event listener is not picking up the keypress.
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2) > IgnoreKeys and co generally only seem to work on `<menupopup>`, not on `<panel>` (and that seems somewhat intentional by reading the code). > > That said Esc is handled everywhere. Esc for panels should be handled [here](https://searchfox.org/mozilla-central/rev/2a69486ab1df00b1ea8ecd14027e2cc6c0415ed0/layout/xul/nsXULPopupManager.cpp#2541). Can you check if that's reached with the popup you care about? It might be that something has prevented the propagation of the event earlier or so... The event listener is a regular capturing event listener on the relevant `document`. Thanks, that seems reasonable. Here's what I did: ```diff --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -19,6 +19,7 @@ #include "nsCSSFrameConstructor.h" #include "nsGlobalWindowOuter.h" #include "nsIContentInlines.h" +#include "nsIConsoleService.h" #include "nsLayoutUtils.h" #include "nsViewManager.h" #include "nsITimer.h" @@ -1258,6 +1259,15 @@ void nsXULPopupManager::HidePopup(Element* aPopup, HidePopupOptions aOptions, if (foundPopup) { if (foundPopup->IsNoAutoHide()) { + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + nsAtom* idAtom = aPopup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Hiding popup "_ns + NS_ConvertUTF8toUTF16(id)).get()); + } // If this is a noautohide panel, remove it but don't close any other // panels. popupToHide = aPopup; @@ -2539,9 +2549,30 @@ bool nsXULPopupManager::HandleKeyboardEventWithKeyCode( uint32_t keyCode = aKeyEvent->KeyCode(); // Escape should close panels, but the other keys should have no effect. + nsCOMPtr<nsIConsoleService> console( + do_GetService(NS_CONSOLESERVICE_CONTRACTID)); + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Handling keyboard event for popup "_ns + + NS_ConvertUTF8toUTF16(id)) + .get()); + } if (aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu) { if (keyCode == KeyboardEvent_Binding::DOM_VK_ESCAPE) { + if (console) { + RefPtr<dom::Element> popup = aTopVisibleMenuItem->Element(); + nsAtom* idAtom = popup->GetID(); + nsAutoCString id; + idAtom->ToUTF8String(id); + console->LogStringMessage( + nsString(u"Maybe hiding popup "_ns + NS_ConvertUTF8toUTF16(id)) + .get()); + } HidePopup(aTopVisibleMenuItem->Element(), {HidePopupOption::IsRollup}); aKeyEvent->StopPropagation(); aKeyEvent->StopCrossProcessForwarding(); ``` So I created 3 console messages. *Message 1* is when the keyboard event is handled. *Message 2* is when Esc specifically is handled and the popup passes the `aTopVisibleMenuItem && aTopVisibleMenuItem->GetPopupType() != PopupType::Menu` check. *Message 3* is when `nsXULPopupManager::HidePopup` is invoked and the popup passes the `foundPopup->IsNoAutoHide()` check. When `noautohide` is _disabled_, I see Message 1 and Message 2, but not Message 3, and the panel is indeed closed. The event never reaches [my custom handler](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#1754) in this case. When `noautohide` is _enabled_, I see none of the 3 messages, and the panel is not closed. The event does reach my handler, but because it's [not focused](https://searchfox.org/mozilla-central/rev/f256e50e068136275c1a2aff827aeddc92a75e07/browser/components/asrouter/modules/FeatureCallout.sys.mjs#333-343), the panel is not dismissed. Of course, we could eliminate that focus check. But we intend to get rid of this custom handler altogether, and bring the callout panel more in line with the rest of the browser. We've heard from Jamie Teh that panel autofocus behavior is going to be disabled by default, so we basically want to remove all the custom handling and let the panel be dismissed on Esc by whatever logic will do that for other, more normal panels. Probably wise to not reinvent the wheel anyway, if there's already much lower-level logic for when to handle e.g. an Esc keypress that bubbles up from within a tabbed browser. So, I'm not sure why `noautohide` would prevent all 3 messages from being reached. It is checked before Message 3, but I don't see any `noautohide` checks upstream of Messages 1 and 2. Here's the relevant markup of the panel, once it's shown: ```html <panel class="panel-no-padding" orient="vertical" noautofocus="true" flip="slide" type="arrow" consumeoutsideclicks="never" norolluponanchor="true" position="bottomcenter topright" show-arrow="" noautohide="true" id="feature-callout" aria-describedby="#feature-callout .welcome-text" side="top" hasbeenopened="true" animate="open" arrow-position="top-end" panelopen="true" /> ``` Oh, and just to be clear, if I click inside the `noautohide` panel and _then_ hit Escape, it shows Message 3, but not Messages 1 and 2. This seems to be because that custom handler I mentioned previously is calling `hidePopup()`, confirmed by breakpoints. So it seems like the XULPopupManager event listener is not picking up the keypress. Edit: Removing `consumeoutsideclicks="never"` from the panel did not resolve the issue.