Return key triggers focused item click in modal with primary action
iLynxcat opened this issue · comments
Describe the bug
Background
By default, at least on macOS, the return key triggers the primary action on an active modal.
In this example where Keyboard Navigation is enabled in System Settings — despite "Cancel" being focused, pressing return will press "Modify Settings" and submit the login form.
In Spacedrive, an open and focused modal will trigger the focused button when return is pressed even if a primary action is present.
Reproduction
- Begin with a fresh Spacedrive library.
- Navigate to Settings (⌘,).
- Navigate to Library → Tags.
- Select a tag. (For instance, Memes).
- Press the Delete button.
- When the confirmation popup activates, first make note that "Cancel" is focused by default, and the primary action is "Delete."
- Press the return key.
After sending return, the focused action (Cancel) was triggered and the tag was not deleted.
Expected behavior
After sending the return keystroke, the primary action (Delete) should have triggered and deleted the tag.
Platform and versions
macOS: 14.3.1 (Sonoma, 23D60)
Spacedrive: v0.2.5 (55d2ec7)
Stack trace
No response
Additional context
In most cases, space is the key used to trigger the focused button rather than return/enter.