sindresorhus/electron-context-menu

The default options like 'cut' 'copy' 'paste', etc. don't show accelerators next to them

ygshbht opened this issue · 5 comments

The default options like 'cut' 'copy' 'paste', etc. don't show accelerators next to them. It would be better if there is an option like there is for labels. Otherwise you need to modify the menu property which is complex and could mess up the order.

What OS did you expect them to show? On macOS, context menus should not have any accelerators. Last time I checked, this applied to Windows too.

Thank you.

Any OS, but yes, MacOS is the main focus here. Right now in Linux, in Chrome iteself or even VSCode, if i right click, i see the acceleartor next to the names.

Even doing this with electron-context-menu shows the accelerators

contextMenu({
    append: (defaultActions, parameters, browserWindow) => [
        new MenuItem({
            // Only enable the menu item for Editable context which supports paste
            visible: parameters.isEditable && parameters.editFlags.canPaste,
            role: 'pasteAndMatchStyle',
            accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AND_MATCH_STYLE,
        }),
        new MenuItem({
            label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'),
            visible: parameters.isEditable && parameters.editFlags.canPaste && clipboard.readText().length > 0,
            accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AS_PLAIN_TEXT,
            click: () => pasteAsPlainText(browserWindow),
        }),
    ],
});

How about doing this if you want to go ahead with the proposal?

ygshbht@6e74a48

Right now in Linux, in Chrome iteself or even VSCode

Chrome and VS Code are not very good at adhering to platform conventions.

I'm not interested in supporting something that breaks platform conventions. If you can prove that a certain OS always uses accelerators in context menus, I may consider it for that platform, but it will never be supported on macOS. Electron apps get a lot of bad reputation for apps feeling non-native and I'm not going to help apps continue this trend.