-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ClickAwayListener] Don't call onClickAway in the event cycle that mounted it #25741
Closed
eps1lon
wants to merge
8
commits into
mui:next
from
eps1lon:feat/clickawaylistener/activate-next-event-cycle
Closed
[ClickAwayListener] Don't call onClickAway in the event cycle that mounted it #25741
eps1lon
wants to merge
8
commits into
mui:next
from
eps1lon:feat/clickawaylistener/activate-next-event-cycle
Conversation
This file contains 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
eps1lon
force-pushed
the
feat/clickawaylistener/activate-next-event-cycle
branch
from
April 13, 2021 10:37
37423df
to
dc41b01
Compare
oliviertassinari
requested changes
Apr 14, 2021
packages/material-ui/src/ClickAwayListener/ClickAwayListener.tsx
Outdated
Show resolved
Hide resolved
packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js
Outdated
Show resolved
Hide resolved
m4theushw
reviewed
Apr 15, 2021
2 tasks
oliviertassinari
approved these changes
May 21, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This alternative fix to #23315 looks OK. It seems interesting that we do no longer rely on a setTimeout, it might make it easier for developers to test on their side.
github-actions
bot
added
the
PR: out-of-date
The pull request has merge conflicts and can't be merged
label
May 25, 2021
It's just fixing a well-specified behavior depending on internals. This is not teachable. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component: ClickAwayListener
The React component
PR: out-of-date
The pull request has merge conflicts and can't be 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.
May break existing tests. For review please only look at
<ClickAwayListener />
tests and implementation. Review per commit is also advised.With event cycle we refer to the order of events that is dispatched during a user mouse press.
Previously
onClickAway
could be called during the same user mouse press that mounted the component. All of the know cases turned out to be undesired so indead of fixing each symptom individually we just completely ignore the user mouse press that mounted the listener.Note that this isn't targetted at #25578 which has the CAL permanently mounted. We can only change #25578 if we check for click-away in mouseup only (essentially removing the
mouseEvent
prop.The required changes to tests are unfortunate. People using
user-event
should have no breakage. Upside is that we force people (app devs) to write their tests closer to what happens in a browser. For libraries built on top of Material-UI the story might look different but that's not really a usage we support anyway.Alternate to #25630