Skip to content

fix(task-board): collapse the search filter chip when cleared externally - #6443

Merged
pedrofrxncx merged 1 commit into
mainfrom
fix/search-toggle-collapse-on-clear-w2
Aug 24, 2026
Merged

fix(task-board): collapse the search filter chip when cleared externally#6443
pedrofrxncx merged 1 commit into
mainfrom
fix/search-toggle-collapse-on-clear-w2

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Source: a state-sync bug found while reading the task-board filter UI (apps/web/src/layouts/task-board/task-filters.tsx), not tied to a specific issue.

Payoff: after clicking "Clear all" (drawer) or the inline "Clear" link (desktop bar) with an active search term, every other filter chip collapses back to its default icon-only state — except the search chip, which stayed visually expanded and empty because its open state was purely internal and only ever reset on its own onBlur. A parent-driven reset (any external change to filters.search, not just the user's own X-button click) never ran that handler.

Failure scenario: type a search term, click elsewhere to blur the search box (it correctly stays expanded showing the term), then click "Clear all" — the search chip remains an empty expanded box instead of collapsing like the rest of the bar.

Fix: track focused via the input's onFocus/onBlur, and when value transitions to "" while the field is not focused, close it. A field the user is actively backspacing to empty (still focused) is untouched — it keeps closing only on its own blur, exactly as before.

Regression test (task-filters-search.test.tsx): re-renders TaskFiltersBar with the search filter cleared (a) after blurring the input — asserts it collapses (input unmounts), and (b) while it's still focused — asserts it stays open, so the fix can't regress into closing under the user mid-edit.

Reviewer command: bun test apps/web/src/layouts/task-board/task-filters-search.test.tsx

Local checks run: bun run fmt, cd apps/web && bunx tsc --noEmit (clean on the touched files), bunx oxlint on both changed files (0 warnings/errors), and the targeted test file above (4/4 pass). Full CI runs the rest.


Summary by cubic

Collapses the task-board search chip when its value is cleared by a parent action. Previously it stayed expanded and empty after “Clear all” or the inline “Clear”; now it collapses unless the input is focused, preserving mid-edit behavior.

  • Track focus with onFocus/onBlur; when value changes to empty while unfocused, close the chip.
  • Keep the focused case unchanged: clearing by typing leaves the chip open until blur.
  • Add regression tests covering both scenarios in apps/web/src/layouts/task-board/task-filters-search.test.tsx.
  • Run tests: bun test apps/web/src/layouts/task-board/task-filters-search.test.tsx.

Written for commit 7996323. Summary will update on new commits.

Review in cubic

The search toggle only closed itself on its own blur handler, so clicking
"Clear all" (or the inline "Clear" link) left it visually expanded and
empty instead of collapsing back to the icon like every other cleared chip.

Track focus and, when the value is reset while unfocused, close the chip;
a field the user is actively backspacing to empty still stays open until
its own blur, unchanged from before.
@pedrofrxncx
pedrofrxncx merged commit 02e1ed9 into main Aug 24, 2026
34 checks passed
@pedrofrxncx
pedrofrxncx deleted the fix/search-toggle-collapse-on-clear-w2 branch August 24, 2026 15:49
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