Skip to content
Snippets Groups Projects
Commit 2de364e0 authored by Sam Johnson's avatar Sam Johnson
Browse files

Bug 1899943 - Show menupopup gutter on macOS only when an item is selected/checked. a=RyanVM

In bug 1668119, I adjusted macOS menupopups to only show a gutter if the menu contains either items that are checkboxes or radios, or checked/selected items of any type. However, this was not quite correct. In native macOS menus, a gutter is only shown if there is a checked/selected item--even if there are checkbox items, there should not be a gutter if no item is checked/selected. This patch matches that behavior.

Original Revision: https://phabricator.services.mozilla.com/D212217

Differential Revision: https://phabricator.services.mozilla.com/D219586
parent b404263f
No related branches found
No related tags found
No related merge requests found
......@@ -19,11 +19,11 @@
// radio/checkbox type menuitems in a menupopup when showing it.
if (e.target.nodeName == "menupopup") {
let haveCheckableChild = e.target.querySelector(
`:scope > menuitem:not([hidden]):is([type=checkbox],[type=radio]${
`:scope > menuitem:not([hidden]):is(${
// On macOS, selected menuitems are checked regardless of type
AppConstants.platform == "macosx"
? ",[checked=true],[selected=true]"
: ""
? "[checked=true],[selected=true]"
: "[type=checkbox],[type=radio]"
})`
);
e.target.toggleAttribute("needsgutter", haveCheckableChild);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment