Match native pop-up button metrics for menulists on macOS 26+
Some checks are pending
CI / Build, Upload (push) Waiting to run
CI / Detect changes (push) Waiting to run
CI / Test () (push) Blocked by required conditions
CI / Test (macOS NFS) (push) Blocked by required conditions
CI / Test (Windows arm64) (push) Blocked by required conditions
CI / Test (Windows x64) (push) Blocked by required conditions
CI / Utilities Tests (push) Waiting to run

Firefox has AppKit draw the menulist's capsule and chevron, but it sizes
the box and positions the label itself, using a fixed dropdown border
and the label's CSS margins. On macOS 27 (and probably 26), that left the
label closer to the edges and the chevron than in a native NSPopUpButton.
It also made the box 26.5px tall. Firefox assumes regular pop-up buttons
are 22px tall and only draws them unscaled in boxes up to 2px taller, so
it drew the control at 22px and scaled the image up, enlarging the
capsule and chevron.

Add padding to match native label insets, and trim the label's vertical
margins to keep the box at 24px, so Firefox draws the control unscaled.
The result measures the same as a native NSPopUpButton.
This commit is contained in:
Dan Stillman 2026-09-28 14:45:30 -04:00
parent 9ea080f896
commit f8ef8e2119

View file

@ -1,3 +1,17 @@
menulist {
line-height: normal;
}
// Match the insets of native pop-up buttons on macOS 26+, which leave more room for the chevron
// than Firefox's dropdown border
@media (-moz-mac-tahoe-theme) {
menulist[native] {
padding-inline: 4px 11px;
// Keep the height at 24px. Firefox scales up the control image when the box is taller
// than its natural height (22px) plus a 2px tolerance, making the chevron and bezel too big.
&::part(label) {
margin-block: 2px;
}
}
}