tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit bfc34eb4cd0058456bee2c30353dc89345f00923
parent 221e69428449644d9f7db790ca3c5b9a9545cfd5
Author: Mark Striemer <mstriemer@mozilla.com>
Date:   Mon, 27 Oct 2025 20:30:13 +0000

Bug 1996369 - Dispatch PanelMultiView keyboard events from moz-button's button r=accessibility-frontend-reviewers,Jamie

Differential Revision: https://phabricator.services.mozilla.com/D270054

Diffstat:
Mbrowser/components/customizableui/PanelMultiView.sys.mjs | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/browser/components/customizableui/PanelMultiView.sys.mjs b/browser/components/customizableui/PanelMultiView.sys.mjs @@ -1916,14 +1916,23 @@ export var PanelView = class extends AssociatedToNode { shiftKey: event.shiftKey, metaKey: event.metaKey, }; + // The a11y-checks want the target to be accessible. For moz-button the + // focus is really on the inner button which is accessible, but we check + // a11y against the event target (moz-button) which fails. Dispatch from + // the inner button element instead. + let target = button; + if (button.localName == "moz-button") { + target = button.buttonEl; + details.composed = true; + } let dispEvent = new event.target.ownerGlobal.MouseEvent( "mousedown", details ); - button.dispatchEvent(dispEvent); + target.dispatchEvent(dispEvent); // This event will trigger a command event too. dispEvent = new event.target.ownerGlobal.PointerEvent("click", details); - button.dispatchEvent(dispEvent); + target.dispatchEvent(dispEvent); this._doingKeyboardActivation = false; break; }