[DateRangePicker] Fix not being opened on click #26016
Merged
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.
Closes #24937
Note that this will break existing tests if you just fired
click
events.I'm at the point where I do think the "activate on mousedown" is better than "activate in the next event loop cycle". To fix facebook/react#20074 we either have to arm on mousedown or use a timer based approach described in https://gist.github.com/bvaughn/fc1c3f27f1aab91c7378f2264f7c3aa1.
So both approaches result in breaking tests. Though with timer based approaches it's much harder to communicate how to test. Is "next event loop cycle" part of the public testing API? How do people discover this? Both of these questions cost us already a lot of time (see popperjs) and are still breaking tests. "activate on mousedown" gives a deterministic API that is already compatible with browser instrumentation (playwright, puppeteer). And saying that "mousedown before click must be dispatched" is far less exotic and even increases test confidence.
Same approach as #25741 but only applied to pickers. It's easier to apply to just PickersPopper since that component is internal.
Manual testing:
https://deploy-preview-26016--material-ui.netlify.app/components/date-range-picker/#basic-usage
https://deploy-preview-26016--material-ui.netlify.app/components/date-picker/#basic-usage