zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.71k stars 3.14k forks source link

Context menu: `enter` does not select hovered action #12796

Open DivineDominion opened 5 months ago

DivineDominion commented 5 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Keyboard-driven selection in Zed's context menus works. Dismissal with e.g. ESC also works. But confirming the selection with enter/return doesn't: it dismisses the context menu without running the action.

Environment

Zed: v0.138.6 (Zed) OS: macOS 14.5.0 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

In this video, clicking the "Paste" context menu item inserts the clipboard content as expected, while navigating down with arrow keys and confirming with enter/return does dismiss the menu without performing the action:

https://github.com/zed-industries/zed/assets/59080/32f9d3d9-dfe6-4416-b150-19e4630bdcb7

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

ConradIrwin commented 4 months ago

A mentioned in the PR, I can't reproduce this and it seems to be working in the video you sent.

Going to close for now, but please re-open if I'm missing something

DivineDominion commented 4 months ago

First: Sorry for the video lacking all cursors and key overlays!

You're right, arrow keys + enter work now.

One thing that's still missing is hovering with the mouse + enter. On macOS, mouse hover and arrow key-based selection produce the same "selected" state, and enter/return commits this.

https://github.com/zed-industries/zed/assets/59080/4b745316-de5e-4107-a4da-ca85abe2784a

ConradIrwin commented 4 months ago

Gotcha! Updated this to represent that.

I believe the PR you sent won't fix that (as we don't update selected_index on hover), but I'd love to fix this if you want to take another pass.

davidwebca commented 2 months ago

One thing I noticed that seems to be related is that when a user types the first letters of the wanted option on their keyboard (ex.: Typing the letter "R" to highlight "Reveal in Finder"), it does nothing. Maybe it's because of some internal context menus instead of using native ones? 🤔