uttrflow / uttrflow/uttrflow-swift
Return doesn't save and Escape doesn't cancel the Dictionary and Snippets inline editors
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
The Dictionary and Snippets inline editors offer Cancel and Save buttons (`MainEditorFooter`, `Sources/Uttrflow/Main/MainPieces.swift:433-453`), but neither has a keyboard equivalent.
- Neither `MainActionButton` in the footer carries `.keyboardShortcut(.defaultAction)` or `.keyboardShortcut(.cancelAction)`.
- None of the fields has `.onSubmit` (`Sources/Uttrflow/Main/DictionaryPageView.swift:129`, `:137`, `Sources/Uttrflow/Main/SnippetsPageView.swift:109`).
- A grep of `Sources/Uttrflow/Main` for `keyboardShortcut`, `onSubmit`, `onExitCommand` and `onKeyPress` returns nothing.
So Return in the word field does nothing and Escape doesn't leave the editor. The only way to finish is to Tab to the button or reach for the pointer.
## Why it matters
Adding a word is a type-and-confirm task, and keyboard users (including anyone using Full Keyboard Access or VoiceOver) expect Return to save and Escape to cancel, as in every macOS form. The Settings confirmation already sets a default button (`Sources/Uttrflow/Settings/SettingsPaneView.swift:47`), so the main window is inconsistent with it.
## How to reproduce
1. Open the Dictionary page and choose Add.
2. Type a word and press Return. Nothing is saved.
3. Press Escape. The editor stays open.
## Acceptance criteria
- Return saves when Save is enabled (`canSave`) and does nothing when it is disabled.
- Escape cancels, the same as the Cancel button.
- In the Snippets editor, Return inside the multi-line `TextEditor` still inserts a newline. ⌘Return saves from there.
- `MainIntentWiringTests` (or a presenter test) covers that the save and cancel intents are unchanged.
## Where to start
- `MainEditorFooter` in `Sources/Uttrflow/Main/MainPieces.swift`: add `.keyboardShortcut(.cancelAction)` to Cancel and `.keyboardShortcut(.defaultAction)` to Save (keep `.disabled(!canSave)`).
- Check that the `TextEditor` in `SnippetsPageView.swift:113` keeps Return for newlines.
- Run `make verify`, and see `CONTRIBUTING.md`.
Size: small.
Contributor guide
Research direction
Start with MainEditorFooter in Sources/Uttrflow/Main/MainPieces.swift, then inspect the DictionaryPageView.swift and SnippetsPageView.swift fields, including the TextEditor at line 113. Run the relevant MainIntentWiringTests or presenter tests and make sure Return saves only when canSave permits it, Escape cancels, and multiline Return remains a newline while ⌘Return saves. Finish by running make verify and checking CONTRIBUTING.md.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- accessibility, desktop
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100