Skip to content

Conversation

@praveenkumar-kalidass
Copy link
Contributor

What does it do?

Clones the event if it is a native event.

Why is it needed?

Not cloning the native event leads to event leaks to its parent.

Related issue(s)/PR(s)

Closes #24740

@mui-pr-bot
Copy link

mui-pr-bot commented Feb 5, 2021

Details of bundle changes

Generated by 🚫 dangerJS against 8050e5d

@eps1lon eps1lon added scope: slider Changes related to the slider. PR: needs test The pull request needs tests. type: bug It doesn't behave as expected. labels Feb 5, 2021
Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work!

Would you be so kind and add a test for this behavior. Otherwise we'll likely remove this code in the future since it's quite exotic.

@oliviertassinari oliviertassinari changed the title [Slider] Send cloned event.target on touch event [Slider] Fix leaky override of event.target Feb 7, 2021
@oliviertassinari oliviertassinari removed the PR: needs test The pull request needs tests. label Feb 7, 2021
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have refined the solution, polished it a bit, and added a test case. It turns out that it only happens with the touch event, e.g. not the mouse down. I have added the target as the third property in case a developer has a specific use case that requires it, and done some other minor improvements.

@oliviertassinari
Copy link
Member

@eps1lon I have fixed your new test case, as well as on the Select component (both were indeed having a global side effect). I believe that the current tradeoff delivers.

@eps1lon eps1lon changed the title [Slider] Fix leaky override of event.target [Slider] Fix override of event.target Feb 9, 2021
@eps1lon eps1lon changed the title [Slider] Fix override of event.target [Slider] Fix override of event.target when preparing change events Feb 9, 2021
eps1lon
eps1lon previously requested changes Feb 9, 2021
Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test in Select

@oliviertassinari oliviertassinari force-pushed the slider-touch-event branch 2 times, most recently from 72432cb to 0b4cf39 Compare February 11, 2021 12:42
Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@eps1lon eps1lon merged commit 7c2a773 into mui:next Feb 12, 2021
@eps1lon
Copy link
Member

eps1lon commented Feb 12, 2021

@praveenkumar-kalidass Thanks for the work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible. scope: select Changes related to the select. scope: slider Changes related to the slider. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Slider] Sends incorrect event.target on touch event

4 participants