Closed Bug 1771792 Opened 2 years ago Closed 2 years ago

Select dropdowns have white font on bright background on macOS when a dark theme is enabled

Categories

(Core :: Widget: Cocoa, defect)

Desktop
macOS
defect

Tracking

()

VERIFIED FIXED
103 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox101 --- unaffected
firefox102 + fixed
firefox103 --- verified

People

(Reporter: mconley, Assigned: emilio)

References

(Regression)

Details

(Keywords: access, regression)

Attachments

(6 files)

Attached image Screenshot of the issue

STR:

  1. In a recent Firefox Nightly, enable the built-in Dark Theme in about:addons
  2. Visit the test case, and open the dropdown

ER:

Light text on a dark background.

AR:

Light text on a light background. See screenshot.

Used mozregression to find the regressor:

13:05.10 INFO: No more integration revisions, bisection finished.
13:05.10 INFO: Last good revision: e06cf44e3b0a181e0fc8bbf348d5f9afda0a86f3
13:05.10 INFO: First bad revision: c8d9ed133a435e0bdda96c27a3175436192cb510
13:05.10 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=e06cf44e3b0a181e0fc8bbf348d5f9afda0a86f3&tochange=c8d9ed133a435e0bdda96c27a3175436192cb510
Attached file Testcase
Keywords: access

[Tracking Requested - why for this release]:

Tracking requested because this is a pretty serious readability / accessibility issue for a standard form element when using the browser dark theme.

:glandium, since you are the author of the regressor, bug 1696504, could you take a look?
For more information, please visit auto_nag documentation.

Flags: needinfo?(mh+mozilla)
Flags: needinfo?(mh+mozilla) → needinfo?(mstange.moz)

We have the same issue for toolbar button dropdown menus.

<select> menus and toolbar button dropdown menus are the only cases we have left where we have "native-looking" menus that are actually non-native.

Flags: needinfo?(mstange.moz)

Executing the following on the Terminal fixes it:

defaults write -g NSVisualEffectViewAllowsVibrancyWorkaround -bool YES

I found this string by running nm AppKit | grep DefaultValueFunction, as described in our SDK docs.

So now we need to find out what "workaround" this is referring to and what we're doing wrong so that we needed this workaround.

Oh, it's probably bug 1736694.

This also "fixes" it fwiw:

diff --git a/widget/cocoa/VibrancyManager.mm b/widget/cocoa/VibrancyManager.mm
--- a/widget/cocoa/VibrancyManager.mm
+++ b/widget/cocoa/VibrancyManager.mm
@@ -33,16 +33,17 @@ static NSAppearance* AppearanceForVibran
         // This must always be dark (dark aqua), regardless of window appearance.
         return [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
       case VibrancyType::TOOLTIP:
       case VibrancyType::MENU:
       case VibrancyType::HIGHLIGHTED_MENUITEM:
       case VibrancyType::SOURCE_LIST:
       case VibrancyType::SOURCE_LIST_SELECTION:
       case VibrancyType::ACTIVE_SOURCE_LIST_SELECTION:
+        return [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
         // Inherit the appearance from the window. If the window is using Dark Mode, the vibrancy
         // will automatically be dark, too. This is available starting with macOS 10.14.
         return nil;
     }
   }

   // For 10.13 and below, a vibrant appearance name must be used. There is no system dark mode and
   // no automatic adaptation to the window; all windows are light.

Not sure if that rings any bells.

This seems to effectively be the old SDK behavior, and fixes contrast
of dark popups on light backgrounds.

Version check might not be wanted / necessary, but I have no way to
test so I haven't touched old macOS versions without dark mode support.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f1a1d3acbd3c
Don't do vibrancy for non-native menus. r=mstange
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/68b233bf0519
Remove some dead vibrancy code. r=mstange

Backed out for causing xpcshell failures on test_css-properties-db.js

Backout link : https://hg.mozilla.org/integration/autoland/rev/e6d5520e1597430acb8acca8551364a5ec4b7f04

Push with failures : https://treeherder.mozilla.org/jobs?repo=autoland&resultStatus=usercancel%2Cretry%2Ctestfailed%2Cbusted%2Cexception%2Crunnable&revision=68b233bf0519e773df31019cef59cb5f92b7fa98&selectedTaskRun=ahqll3ueQ1WQN5xXyoFCSw.0

Link to failure log : https://treeherder.mozilla.org/logviewer?job_id=379680699&repo=autoland&lineNumber=2588

Failure line:
TEST-UNEXPECTED-FAIL | devtools/shared/tests/xpcshell/test_css-properties-db.js | xpcshell return code: 0
TEST-UNEXPECTED-FAIL | devtools/shared/tests/xpcshell/test_css-properties-db.js | run_test - [run_test : 73] The static database and platform do not match for

Flags: needinfo?(emilio)
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7a8d99446c2f
Remove some dead vibrancy code. r=mstange
Has Regression Range: --- → yes
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch

Comment on attachment 9278840 [details]
Bug 1771792 - Don't do vibrancy for non-native menus. r=mstange

Beta/Release Uplift Approval Request

  • User impact if declined: comment 0
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): One-liner that affects just menus that aren't native (selects, long-press on back button, etc), and restores previous behavior before the SDK update.
  • String changes made/needed: none
  • Is Android affected?: No
Attachment #9278840 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9278840 [details]
Bug 1771792 - Don't do vibrancy for non-native menus. r=mstange

Low risk, visible impact, approved for 102 beta 3, thanks.

Attachment #9278840 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
See Also: → 1772126
QA Whiteboard: [qa-triaged]

I could not reproduce the issue on builds without the fix on Mac 10.13 using multiple nightly builds 102.0a1(20220526213638). Can you please mention what Mac OS were you using?

Flags: needinfo?(mconley)

I'm on macOS Monterey 12.1. Thankfully, I can confirm that the latest build of Nightly no longer has the issue for me.

Flags: needinfo?(mconley)
Status: RESOLVED → VERIFIED

I wasn't able to reproduce the issue on MacOS 12 or MacOS 12.3.1 on my end so I cannot verify the fix myself, but since Mike already confirmed it I'm removing the qe-verify+ flag.

QA Whiteboard: [qa-triaged]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: