fune/browser/base/content/hiddenWindowMac.xhtml
Markus Stange 474bbc636c Bug 1706337 - Avoid spurious accessibility notifications from the Dock menu. r=Gijs
macOS calls `-[MacApplicationDelegate applicationDockMenu:]` shortly after startup.
We fire popupshowing/shown/hiding/hidden events for the Dock menu when this
happens, mostly for consistency with other menus. Accessibility code was
processing these events and turning them into unintended accessibility notifications.

The Dock menu is a "native menu", but it is not covered by the workaround from
bug 1703482 because it's not a native *context* menu. It's its own special thing
and makes use of nsIMacDockSupport and nsIStandaloneNativeMenu and some JS glue
code.

Prior to the "Simplify nsMenuX state management" patch from bug 1699551, we were
*not* firing the popup DOM events for the Dock menu, mostly by accident.
In fact, it looks like we were only ever firing the events if a DOM modification
had occurred in the menu between menu construction and the current menu opening.
That's definitely not what we want and I'm surprised we got away with it for so
long.

Differential Revision: https://phabricator.services.mozilla.com/D113599
2021-04-27 22:33:23 +00:00

37 lines
1.3 KiB
HTML

<?xml version="1.0"?>
# -*- Mode: HTML -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define HIDDEN_WINDOW
<?xml-stylesheet href="chrome://browser/skin/webRTC-menubar-indicator.css" type="text/css"?>
<!DOCTYPE window [
#include browser-doctype.inc
]>
<window id="main-window"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
data-l10n-sync="true">
#include macWindow.inc.xhtml
<!-- Dock menu -->
<popupset>
<!-- Hide this menupopup from the accessibility tree so that we don't fire
any unintended accessibility notifications for it. Accessibility for the
Dock menu is handled natively by macOS. -->
<menupopup id="menu_mac_dockmenu" aria-hidden="true">
<!-- The command cannot be cmd_newNavigator because we need to activate
the application. -->
<menuitem label="&newNavigatorCmd.label;" oncommand="OpenBrowserWindowFromDockMenu();"
id="macDockMenuNewWindow" />
<menuitem label="&newPrivateWindow.label;" oncommand="OpenBrowserWindowFromDockMenu({private: true});"
id="macDockMenuNewPrivateWindow" />
</menupopup>
</popupset>
</window>