fix(task-board): collapse the search filter chip when cleared externally - #6443
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
openstate was purely internal and only ever reset on its ownonBlur. A parent-driven reset (any external change tofilters.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
focusedvia the input'sonFocus/onBlur, and whenvaluetransitions 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-rendersTaskFiltersBarwith 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.tsxLocal checks run:
bun run fmt,cd apps/web && bunx tsc --noEmit(clean on the touched files),bunx oxlinton 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.
onFocus/onBlur; whenvaluechanges to empty while unfocused, close the chip.apps/web/src/layouts/task-board/task-filters-search.test.tsx.bun test apps/web/src/layouts/task-board/task-filters-search.test.tsx.Written for commit 7996323. Summary will update on new commits.