Skip to content

Fix note composer key handling: use NSViewRepresentable instead of onKeyPress#15

Merged
execsumo merged 1 commit into
masterfrom
claude/fix-ci-failures-4cP39
May 19, 2026
Merged

Fix note composer key handling: use NSViewRepresentable instead of onKeyPress#15
execsumo merged 1 commit into
masterfrom
claude/fix-ci-failures-4cP39

Conversation

@execsumo

Copy link
Copy Markdown
Owner

SwiftUI's onKeyPress modifier never fires inside a TextEditor because the
underlying NSTextView consumes Return before the SwiftUI event system sees it.
The PR #12 approach (onKeyPress on the overlay-decorated TextEditor) also had
an overload-resolution ambiguity with the zero-arg vs KeyPress-arg variants
that caused build failures on the macos-15 CI runner.

Replace TextEditor + onKeyPress with a custom NoteTextEditor NSViewRepresentable
that wraps NoteNSTextView. The NSTextView subclass overrides keyDown to route
plain Return → submit and Cmd+Return → newline, and grabs first-responder in
viewDidMoveToWindow so the panel is immediately ready to type into.

https://claude.ai/code/session_01YRGEDv6VQZzf6o6B54UJ5C

…KeyPress

SwiftUI's onKeyPress modifier never fires inside a TextEditor because the
underlying NSTextView consumes Return before the SwiftUI event system sees it.
The PR #12 approach (onKeyPress on the overlay-decorated TextEditor) also had
an overload-resolution ambiguity with the zero-arg vs KeyPress-arg variants
that caused build failures on the macos-15 CI runner.

Replace TextEditor + onKeyPress with a custom NoteTextEditor NSViewRepresentable
that wraps NoteNSTextView. The NSTextView subclass overrides keyDown to route
plain Return → submit and Cmd+Return → newline, and grabs first-responder in
viewDidMoveToWindow so the panel is immediately ready to type into.

https://claude.ai/code/session_01YRGEDv6VQZzf6o6B54UJ5C
@execsumo
execsumo merged commit 99ce652 into master May 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants