[Bug]: Accelerator null on predefined menu roles
johnbwoodruff opened this issue · comments
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
19.0.4
What operating system are you using?
macOS
Operating System Version
macOS Monterey 12.4
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
No response
Expected Behavior
When getting the menu via Menu.getApplicationMenu()
, the accelerators should not be null
for the predefined menu roles such as copy, paste, etc.
Actual Behavior
Any menu items with a user-defined accelerator correctly returns the accelerator, but any of the predefined menu roles such as undo, redo, cut, copy, paste, etc. return null
for the accelerator, despite those accelerators being registered and working.
Testcase Gist URL
https://gist.github.com/johnbwoodruff/725227db5ae734f73de6efd3af2a7960
Additional Information
The accelerators are definitely defined for these predefined roles. The hotkeys work correctly, and they're displayed when the native menu is rendered. However, if you want to render your own custom menu, you won't know those accelerators as they are returned as null
.
You can see in
electron/lib/browser/api/menu-item-roles.ts
Lines 36 to 41 in 5af6b89
Menu.getApplicationMenu()
.@johnbwoodruff I repro'ed this, but I could reproduce the behavior as far back as Electron 16. Was this working in previous versions of Electron for you?
@VerteDinde I haven't had this usecase until now so I'm not sure if it ever worked. I would guess it hasn't ever worked, but I could be wrong about that.
Also thank you for looking into this! Let me know if there's any more info I can provide. I tried to be thorough with the fiddle.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
I just validated that this is still an issue in the latest version of electron. (20.0.0)
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
Just validated that this is still an issue in the latest version of Electron. (v24.1.2)
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
Just validated that this is still an issue in the latest version of Electron (v25.3.1)
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
Just checked and this is still an issue in the latest version. (v27.0.2)
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.