Fix clearing a filter that holds a partially entered date or number - #209
Open
Kven1 wants to merge 4 commits into
Open
Fix clearing a filter that holds a partially entered date or number#209Kven1 wants to merge 4 commits into
Kven1 wants to merge 4 commits into
Conversation
Fix clearing a filter that holds a partially entered date or number
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.
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.