Skip to content

Allow +/- to initiate chips on mobile#125

Open
paperboyo wants to merge 1 commit into
mainfrom
mk-claude-mobile-plus-minus
Open

Allow +/- to initiate chips on mobile#125
paperboyo wants to merge 1 commit into
mainfrom
mk-claude-mobile-plus-minus

Conversation

@paperboyo
Copy link
Copy Markdown

Co-authored by Claude Opus 4.6, description written by a human, 48.

What does this change?

Chips are impossible to add using mobile keyboard. This was verified to work. I checked if it negatively affects desktop, but couldn't find any issues. 🤖 was adamant it’s OK, but they often are.

🤖 says:

Fix: chip trigger (+/-) on mobile virtual keyboards

Mobile virtual keyboards (Android, iOS) often don't fire keydown events with correct event.key values for punctuation — they arrive as key: "Unidentified" or go through composition/input events instead. This means the existing handleKeyDown check for +/- never fires on mobile, making chip creation impossible on touch devices.

Fix

Add handleTextInput plugin prop — ProseMirror's input-method-agnostic hook that fires whenever text is inserted regardless of input mechanism. It calls the same maybeAddChipAtPolarityChar function, so all existing guards (no mid-word triggers, - adjacency check) still apply.

Why it's safe for desktop

On desktop, handleKeyDown catches +/- first and returns true → ProseMirror calls preventDefault() → the text is never inserted → handleTextInput never fires. The new code path is unreachable on desktop keyboards.

How has this change been tested?

All 197 tests pass, 0 failures. Tested on Chrome for Android latest beta.

How can we measure success?

If someone would want to use chips on mobile they will feel instant success.

@github-actions
Copy link
Copy Markdown
Contributor

@paperboyo paperboyo added the fix Departmental tracking: fix label May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables chip creation via +/- characters from mobile virtual keyboards, which often don't fire keydown events with reliable event.key values for punctuation. Adds a handleTextInput ProseMirror plugin hook that calls the same chip-creation logic as the existing handleKeyDown path. On desktop, handleKeyDown already preempts the input by returning true, so the new path is only exercised on mobile.

Changes:

  • Add handleTextInput to the CQL ProseMirror plugin to detect +/- insertions from input methods that bypass keydown.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Departmental tracking: fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants