Repository navigation
Conversation
With allowInput, clicking a day blurs the (alt) input first. The blur handler committed the typed text right away — fp.clear() for an empty box, fp.setDate() otherwise — which redraws the calendar between mousedown and mouseup. The click then lands on a replaced element and nothing is selected: every day had to be clicked twice. While the pointer is down inside the calendar (or focus moves into it) the blur is left alone; the selection or onClose commits the value. Typing and leaving the field elsewhere commits as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
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.
Problem
With
->allowInput(), a day in the calendar has to be clicked twice when the text box has focus (which it has right after opening the picker by clicking into the field).Clicking a day blurs the (alt) input first.
bindManualInputEvents()commits the typed text on that blur:fp.clear()for an empty box,fp.setDate()otherwise. Both redraw the calendar betweenmousedownandmouseup, so the click lands on an element that is no longer in the document and nothing gets selected. The second click works because the input is no longer focused.To reproduce: a
Flatpickr::make('day')->allowInput()field, click into the empty field, click a day once.Fix
While the pointer is down inside the calendar, or focus moves into it, the blur handler leaves the value alone; the selection (or
onClose) commits it. Typing a date and leaving the field elsewhere commits exactly as before.resources/dist/components/flatpickr.jsis rebuilt withnpm run build:scripts; no other built file changed.Verification
I ran the old and the new bundle through the same sequence in jsdom (mousedown on a day, blur on the alt input, mouseup, click):
A typed date followed by a normal blur gives the same state in both builds. I have not added a JS test because the repository has none to extend; happy to add one if you have a preferred setup.
🤖 Generated with Claude Code