Skip to content

Conversation

@eps1lon
Copy link
Member

@eps1lon eps1lon commented Aug 16, 2018

This is a breaking change.

Previously only the value was passed to the onChange callback despite the documentation mentioning the event as the first arg. Since every other on* callback in the core passes the event as the first argument we use the same approach here.

This component is currently listed under lab so breaking changes should be expected.

Closes #12546 although I'm not sure if this actually resolves that specific use case. One could make an argument to use the same approach as SelectInput https://github.com/mui-org/material-ui/blob/62ef11d3485fd13ad11ac6dc2b2446aab5550d32/packages/material-ui/src/Select/SelectInput.js#L71 because that might be more likely to solve the specific use case mentioned. But then Tab uses the same approach as ToogleButtonGroup https://github.com/mui-org/material-ui/blob/62ef11d3485fd13ad11ac6dc2b2446aab5550d32/packages/material-ui/src/Tab/Tab.js#L132
Also closes #12326

Might be time to start a discussion how a consistent onChange api for elements with children should look or if we want to avoid over abstraction here since changing the api in the core introduces breaking changes.

@eps1lon
Copy link
Member Author

eps1lon commented Aug 16, 2018

Current CI fails are resolved by #12535 and #12537.

@oliviertassinari oliviertassinari added the package: lab Specific to the lab. label Aug 16, 2018
@eps1lon eps1lon force-pushed the feat-toggle-button-group-event branch from 743a1db to c5e456e Compare August 20, 2018 09:14
@mbrookes mbrookes added the breaking change Introduces changes that are not backward compatible. label Aug 25, 2018
Copy link
Member

@mbrookes mbrookes left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@eps1lon eps1lon force-pushed the feat-toggle-button-group-event branch 4 times, most recently from cafb1f3 to 298575d Compare September 2, 2018 09:45
This is a breaking change.

Previously only the value was passed to
the onChange callback despite the documentation mentioning
the event as the first arg. Since every other on* callback in the core
passes the event as the first argument we use the same approach here.
@eps1lon eps1lon force-pushed the feat-toggle-button-group-event branch from 298575d to ec6087e Compare September 2, 2018 18:51
@mbrookes mbrookes merged commit 8456f76 into mui:master Sep 7, 2018
@eps1lon eps1lon deleted the feat-toggle-button-group-event branch September 22, 2018 21:31
marcelpanse pushed a commit to marcelpanse/material-ui that referenced this pull request Oct 2, 2018
This is a breaking change.

Previously only the value was passed to
the onChange callback despite the documentation mentioning
the event as the first arg. Since every other on* callback in the core
passes the event as the first argument we use the same approach here.
@oliviertassinari oliviertassinari added scope: toggle button Changes related to the toggle button. and removed package: lab Specific to the lab. labels Jan 9, 2021
@oliviertassinari oliviertassinari changed the title [ToggleButtons] normalize onChange api [ToggleButton] normalize onChange api Jan 9, 2021
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: toggle button Changes related to the toggle button.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants