Skip to content

fix(modals): keep separators when typing comma-separated tags - #2518

Merged
callumalpass merged 1 commit into
mainfrom
fix/modal-tags-keystrokes
Nov 8, 2026
Merged

callumalpass merged 1 commit into
mainfrom
fix/modal-tags-keystrokes

Conversation

@callumalpass

Copy link
Copy Markdown
Owner

Fixes a regression from #2501 that blocks 4.17.0. If you type work, home keystroke by keystroke into the task create modal's Tags field, you get workhome. Pasting the whole string works.

Cause

After each form edit, syncFormControls copies the form's values back into the modal's controls. The tags field stores sanitizeTags(value), which drops a trailing , , so as soon as you type the comma it is removed from the focused input.

Change

  • syncFormControls no longer overwrites the contexts or tags input while it has focus. User fields and time estimate already skip the focused input.
  • When the Tags field loses focus, it shows the sanitised value, so you still see what will be saved. This keeps what feat(modals): rebuild task create and edit modals #2501 intended.

Other fields checked

  • Tags: the only field affected. It is the only one whose stored value differs from what was typed.
  • Contexts and title: they store exactly what you type, so the write-back never changed them. Contexts gets the same guard anyway, for consistency.
  • User fields: already skip the focused input.
  • Time estimate: already skips the focused input and reformats when the field loses focus.
  • Projects: a chip picker, not free text.

Tests

  • New e2e/issues/pr-2501-tags-keystrokes.spec.ts: types tags and contexts keystroke by keystroke, and checks that tags are sanitised when the field loses focus. It fails on main ("workhome") and passes with this fix.
  • Isolated Obsidian e2e: this spec plus task-modal, issue-2148, issue-2404 and issue-2421: 26 passed.
  • Jest tests/unit/modals and the tag-related issue tests: 299 passed.
  • npm run lint, npm run typecheck and npm run build pass.

Release notes

None added. No stable release has had #2501; 4.17.0 is the first. It did ship in the 5.0.0-beta.7 prerelease, so the beta line needs this fix too.

The task modal syncs every control from the form after each edit. The
tags field stores a sanitised value, which drops a trailing comma, so
writing it back into the focused input erased the separator: typing
"work, home" produced "workhome". Skip the write-back for the focused
contexts and tags inputs, as user fields and time estimate already do,
and show the sanitised tags when the field is left.
@callumalpass
callumalpass merged commit 72d7901 into main Nov 8, 2026
3 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.

1 participant