Skip to content

fix: update label/sublabel/icon in MenuItems on open - #49678

Merged
jkleinsc merged 1 commit into
mainfrom
allow-changing-menu-title-label-macos
Feb 27, 2026
Merged

jkleinsc merged 1 commit into
mainfrom
allow-changing-menu-title-label-macos

Conversation

@codebytere

@codebytere codebytere commented Feb 5, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Closes #7627

Our switch to manually managing NSMenuItem state pre-open finally allows us to dynamically update menu items across platforms.

macOS

Screenshot 2026-02-04 at 7 05 24 PM

Linux

Screenshot 2026-02-04 at 7 05 11 PM

macOS

Screenshot 2026-02-04 at 7 36 31 PM

Tested with https://gist.github.com/codebytere/47d4fe1f42fb953591500338c9846860

Checklist

Release Notes

Notes: Allow dynamically updating menu item labels, sublabels, and icons.

@codebytere codebytere added semver/minor backwards-compatible functionality target/40-x-y PR should also be added to the "40-x-y" branch. target/41-x-y PR should also be added to the "41-x-y" branch. labels Feb 5, 2026
@codebytere
codebytere requested a review from a team February 5, 2026 07:06
@codebytere
codebytere force-pushed the allow-changing-menu-title-label-macos branch from d217100 to 724df6c Compare February 5, 2026 07:07
@codebytere codebytere changed the title fix: update label/sublabel/icon in macOS item on open fix: update label/sublabel/icon in MenuItems on open Feb 6, 2026
@codebytere
codebytere force-pushed the allow-changing-menu-title-label-macos branch from 724df6c to 3ed2b81 Compare February 9, 2026 14:40
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Feb 12, 2026
@codebytere
codebytere force-pushed the allow-changing-menu-title-label-macos branch 2 times, most recently from 2af7f04 to 52b0ba5 Compare February 19, 2026 10:07
isolate, const_cast<Menu*>(this), "_getLabelForCommandId", command_id);
std::u16string label;
if (!gin::ConvertFromV8(isolate, val, &label))
label.clear();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) not a blocker or anything, asking more for my own understanding -- is this .clear() call ever needed? Is it possible for gin::ConvertFromV8() to populate label on 112 and still return false?

@erickzhao erickzhao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM :)

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, just needs a doc update. Also, we should add/update tests for this.

Comment thread docs/api/menu-item.md Resolved
@codebytere
codebytere requested a review from jkleinsc February 26, 2026 13:01
@codebytere
codebytere force-pushed the allow-changing-menu-title-label-macos branch from 52b0ba5 to 1166d02 Compare February 26, 2026 13:01
@jkleinsc
jkleinsc merged commit 3d1cc39 into main Feb 27, 2026
108 of 109 checks passed
@release-clerk

release-clerk Bot commented Feb 27, 2026

Copy link
Copy Markdown

Release Notes Persisted

Allow dynamically updating menu item labels, sublabels, and icons.

@jkleinsc
jkleinsc deleted the allow-changing-menu-title-label-macos branch February 27, 2026 17:47
@trop

trop Bot commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "41-x-y", please check out #49972

@trop trop Bot added in-flight/41-x-y and removed target/41-x-y PR should also be added to the "41-x-y" branch. labels Feb 27, 2026
@trop

trop Bot commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "40-x-y", please check out #49973

@trop trop Bot added in-flight/40-x-y merged/41-x-y PR was merged to the "41-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. and removed target/40-x-y PR should also be added to the "40-x-y" branch. in-flight/41-x-y in-flight/40-x-y labels Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/approved ✅ merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dynamically changing a menu item's label

4 participants