Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ugh, Slack too. For ages they didn't have right-click menus anywhere. Then a while ago, they added right-click menus to channels, but of course they couldn't just use the native menus that every OS already has, so it's some HTML abomination that had to rewrite the wheel for handling things like lenient mouse movement (e.g. https://css-tricks.com/dropdown-menus-with-more-forgiving-mo...). Still doesn't support type-to-select, or god knows how many other accessibility and power user niceties.


I don't know if Electron has an API for menus, but the HTML elements that let you add items to the native contextmenu were scrapped, and every browser I know of renders their own menus on Windows/Linux anyway. There is not a way to add a native contextmenu unless you do something cursed like positioning an invisible <select> where the mouse is and opening it on right click.

Edit: Never mind, there is no way to open a <select> with JS.


I know, but other Electron apps manage to do it (VS Code, Postman), so there must be a way.

edit: some quick googling reveals there is an API for this https://www.electronjs.org/docs/latest/api/menu#class-menu




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: