fix: apply default accelerator for role-based menu items #48410
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Role-based menu items (copy, paste, cut, etc.) were returning null for their accelerator property instead of the expected keyboard shortcuts defined in menu-item-roles.ts.
Fixed by passing roles.getDefaultAccelerator(this.role) as the default value to overrideReadOnlyProperty('accelerator').
Description of Change
Fixes #48313
Role-based menu items (copy, paste, cut, undo, redo, selectall, etc.) were returning
null
for theiraccelerator
property instead of the expected keyboard shortcuts defined inmenu-item-roles.ts
.The issue was in
lib/browser/api/menu-item.ts
line 28, whereoverrideReadOnlyProperty('accelerator')
was called without a default value, causing the accelerator to be set tonull
instead of the predefined shortcuts likeCommandOrControl+C
,CommandOrControl+V
, etc.This fix passes
roles.getDefaultAccelerator(this.role)
as the default value tooverrideReadOnlyProperty('accelerator')
, making it consistent with how other properties likelabel
andregisterAccelerator
are handled.Checklist
npm test
passesRelease Notes
Notes: Fixed role-based menu items returning correct keyboard accelerators instead of null.