Skip to content

Quick add: Backspace edits a token being typed - #2220

Queued
pixari wants to merge 2 commits into
mainfrom
fix/2219-backspace-autocomplete
Queued

pixari wants to merge 2 commits into
mainfrom
fix/2219-backspace-autocomplete

Conversation

@pixari

@pixari pixari commented Nov 28, 2026

Copy link
Copy Markdown
Member

What and why

Fixes #2219.

If the caret sat right after @err, #Home, +30m or p1, it took three presses of Backspace to delete one character. The token had already been parsed into a chip, so the keyboard dismissal took over Backspace. The first press highlighted the chip, which looked like focus leaving the field. The second press dismissed it. Only the third press deleted a character. Text with no match produced no chip, so Backspace worked there.

We changed chipAtCaret (web/src/lib/nlp/quickadd.ts). It now returns no chip for an attribute token (#project, @label, p1–p4, +duration, spent/estimate, ~energy) when the caret touches it with no space after it, so Backspace deletes normally. The two-press dismissal still works in these cases:

  • after a space
  • after a phrase (date, recurrence, reminder, link)
  • with the chip's × control

OpenSpec change backspace-edits-typed-token is archived in this PR. It modifies natural-language-capture "Dismiss and escape parsed tokens" and adds two scenarios. docs/quick-add.md is updated, and the fix has a changelog fragment.

Tests:

  • quickAdd.test.tsx "Backspace while typing a token": @err, @errand, #Home, +30m and p1 each delete on one press. After a space, two presses still dismiss.
  • quickadd.test.ts gets a new chipAtCaret case. Two existing cases now type p2 last with a space after it, or end on a date.
  • All six new tests fail without the fix.

No UI or layout change, so no visual baselines change.

Checklist

  • Behaviour changes start as an OpenSpec change (openspec/changes/<name>/), or this PR has none
  • One change per pull request; make check passes locally (we ran typecheck, eslint on the touched files, the quick add and nlp vitest suites, openspec validate --all --strict, make docs and make docs-check; we left the full make check to CI)
  • Commits credit every author, AI tools included, with a Co-Authored-By trailer
  • Data writes go through ops (no direct task/project row writes)
  • New API routes are registered with a policy in internal/httpapi/policy.go (public("reason") only when the spec says so)
  • No telemetry, no new third-party requests, no new mandatory env vars
  • Docs updated and a changelog entry added as changelog.d/<Section>/<name>.md (not in CHANGELOG.md); size impact noted for new dependencies
  • Templates only: I wrote the template in templates/ (or may license it) and agree to publish it under CC BY 4.0; make templates is committed

Generated by Claude Code

With the caret right after `@err`, `#Home`, `+30m` or `p1`, Backspace
highlighted the token's chip, then dismissed it, and only the third press
deleted a character. chipAtCaret now leaves an attribute token the caret
touches to Backspace; after a space the two-press dismissal is unchanged.

OpenSpec change backspace-edits-typed-token, archived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187cnkXBm72ZSggGvrvUMKW
Links had the same three presses as the other tokens: add 'link' to
TOKEN_KINDS, with unit and component tests. The caret/selection test
ends in a phrase again so it tests the check. The spec says whitespace,
the keyboard dismissal scenario names a phrase or a space, the links
requirement's Backspace scenario ends with a space, and the docs read as
one sentence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187cnkXBm72ZSggGvrvUMKW
@pixari
pixari marked this pull request as ready for review November 28, 2026 17:41
@pixari
pixari enabled auto-merge November 28, 2026 17:41
@pixari
pixari added this pull request to the merge queue Nov 28, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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.

Backspace is unreliable in task entry fields when autocomplete matches

2 participants