[ClickAwayListener] Don't call onClickAway in the event cycle that mounted it#25741
Closed
eps1lon wants to merge 8 commits into
Closed
[ClickAwayListener] Don't call onClickAway in the event cycle that mounted it#25741eps1lon wants to merge 8 commits into
eps1lon wants to merge 8 commits into
Conversation
eps1lon
force-pushed
the
feat/clickawaylistener/activate-next-event-cycle
branch
from
April 13, 2021 10:37
37423df to
dc41b01
Compare
eps1lon
marked this pull request as ready for review
April 13, 2021 11:03
oliviertassinari
requested changes
Apr 14, 2021
m4theushw
reviewed
Apr 15, 2021
2 tasks
oliviertassinari
approved these changes
May 21, 2021
oliviertassinari
left a comment
Member
There was a problem hiding this comment.
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.
Member
Author
|
It's just fixing a well-specified behavior depending on internals. This is not teachable. |
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.
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
onClickAwaycould 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
mouseEventprop.The required changes to tests are unfortunate. People using
user-eventshould 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