#54514·electron

Keep menu item images visible when building against the macOS 27 SDK

Author: thomasbachemCreated Sep 28, 2026Updated Sep 28, 2026

Preflight Checklist

Problem Description

While checking our app against macOS 27, I came across this in Apple's release notes: Apps built against the macOS 27 SDK get every image they put on a menu item hidden, symbol images and regular ones alike, unless they also set the new preferredImageVisibility on the NSMenuItem. With the 26 SDK, only symbol images are hidden.

Electron is still on the 26 SDK, so current releases are fine. But once it switches, every icon set on a MenuItem would disappear on macOS 27, and apps couldn't do anything about it. For some apps that's more than a cosmetic problem. The tray menu I'm working on, for example, shows each meeting's start time and color as the item's icon.

Chromium just fixed this for its own menus by setting preferredImageVisibility wherever it assigns a menu item image (crrev.com/c/8463164). Electron's menus don't go through that code though, because ElectronMenuController sets item.image itself.

I haven't been able to try this myself, since there's no Electron build on the 27 SDK yet.

Proposed Solution

Do the same as Chromium and set preferredImageVisibility to visible wherever Electron sets a menu item image. If an app sets an icon, it wants it shown, so I'd just keep the current behavior.

As far as I can tell, that's three places in electron_menu_controller.mm: makeMenuItemForIndex:, applyStateToMenuItem: and menuItemForService:. Chromium's new ui/base/cocoa/macos27_sdk.h already declares the property for builds against the 26 SDK.

Alternatives Considered

  • Exposing preferredImageVisibility as a MenuItem option instead: Existing apps would lose their icons on macOS 27 until they opt in. It could still be useful later as an override
  • Leaving AppKit's default in place: Apps would silently lose icons they set on purpose

Additional Information