Skip to content

[DateRangePicker] Fix not being opened on click#26016

Merged
eps1lon merged 3 commits intomui:nextfrom
eps1lon:fix/pickers/clickaway
Apr 29, 2021
Merged

[DateRangePicker] Fix not being opened on click#26016
eps1lon merged 3 commits intomui:nextfrom
eps1lon:fix/pickers/clickaway

Conversation

@eps1lon
Copy link
Member

@eps1lon eps1lon commented Apr 28, 2021

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

@eps1lon eps1lon added type: bug It doesn't behave as expected. component: DateRangePicker The React component labels Apr 28, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Apr 28, 2021

Details of bundle changes

Generated by 🚫 dangerJS against d005976

@eps1lon eps1lon marked this pull request as ready for review April 28, 2021 15:18
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Apr 29, 2021
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Apr 29, 2021
@eps1lon eps1lon merged commit a6a04b6 into mui:next Apr 29, 2021
@eps1lon eps1lon deleted the fix/pickers/clickaway branch April 29, 2021 08:20
eps1lon added a commit to siriwatknp/material-ui that referenced this pull request Apr 29, 2021
siriwatknp added a commit that referenced this pull request May 12, 2021
* migrate to emotion

* make styleProps optional

* remove lint and add fn name

* use yearButton from styles

* revert types

* [docs] Document all the colors available (#26015)

* [Timeline] Add support for position override on items (#25974)

* [core] Remove deprecated innerRef prop (#26028)

[core] Remove deprecated innerRef prop (#26028)

* [theme] Rename `createMuiTheme` to `createTheme` (#25992)

* [pickers] Remove redundant aria-hidden (#26014)

* [internal][pickers] Remove unused styles (#26023)

* [pickers] Toggle mobile keyboard view in the same commit as the view changes (#26017)

* [DateRangePicker] Fix not being opened on click (#26016)

* Inline classes

* type -> interface

* sort asc

* default props are private

* remove uneccesary type casting

* follow convention

* trigger pipeline

Co-authored-by: Anshuman Pandey <54475686+anshuman9999@users.noreply.github.com>
Co-authored-by: simonecervini <69400730+simonecervini@users.noreply.github.com>
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: DateRangePicker The React component type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DateRangePicker] Does not open on trigger click Bug: useEffect Timing changes depending on if Portal was rendered

2 participants