Unreadable text when using the `attributedTitle` property of `NSMenuItem` in Mojave Dark Mode

Originator:sindresorhus
Number:rdar://42699654 Date Originated:29-Jul-2018 12:13 PM
Status:Closed Resolved:Yes
Product:macOS + SDK Product Version:macOS 10.14
Classification:Serious Bug Reproducible:Always
 
Summary:
When using the `attributedTitle` of `NSMenuItem` in Dark Mode in Mojave, the text becomes illegible.

When using the following the text looks normal:

```swift
let menu = NSMenuItem(title: "Menu Item with Title", action: nil, keyEquivalent: "")
```

But when using an attributed title like this:

```swift
let menu = NSMenuItem(title: "", action: nil, keyEquivalent: "")
menu.attributedTitle = NSAttributedString(string: "Menu Item with Attributed Title")
```

The text becomes almost unreadable.

This was not a problem in macOS 10.13.

See attached screenshots for difference between macOS 10.13 and 10.14.

Steps to Reproduce:
- Open and run the attached Xcode project.
- Open the "File" menu and notice how the "Menu Item with Attributed Title" entry is almost unreadable and different from the non-attributed one.

Expected Results:
I expected the text when using an attributed title to be the same as the non-attributed title.

Actual Results:
The attributed title menu item is different and almost unreadable.

Version:
macOS 10.14

Notes:
macOS 10.14 beta 4

Comments

No longer reproducible in beta 11

By sindresorhus at Sept. 20, 2018, 6:23 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!