Skip to content

Fix clearing a filter that holds a partially entered date or number - #209

Open
Kven1 wants to merge 4 commits into
sevenseacat:mainfrom
Forge-of-Apps:main
Open

Fix clearing a filter that holds a partially entered date or number#209
Kven1 wants to merge 4 commits into
sevenseacat:mainfrom
Forge-of-Apps:main

Conversation

@Kven1

@Kven1 Kven1 commented Aug 2, 2026

Copy link
Copy Markdown

Type a date into a date-range filter, then delete one of its segments — leave mm/05/2026 with the month blank. Clicking the × doesn't clear the field: the parts you typed stay on screen. And if that half-typed date is the only thing in the filter, there's no × to click at all.

Why. For a partially entered date the browser reports value === "" and sets validity.badInput. The change event therefore tells the server the filter is empty, the filter is dropped from state, and the input re-renders with value="" — exactly what it rendered before. No diff reaches that input, and even when one does, morphdom skips the assignment because both values are "". What's still on screen lives in the input's segment state, and only assigning input.value drops it. number inputs behave the same way with unparseable input. The missing × is the other half: its visibility follows the server-side filter value, which is empty here.

Fix. The clear buttons carry a colocated runtime hook that empties the inputs the browser reports as :invalid, and group-has-[input:invalid] keeps the button reachable in that state. Valid values are still cleared by the usual diff, and nothing else is touched.

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.

2 participants