Skip to content
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

[ToggleButton] normalize onChange api #12549

Merged
merged 1 commit into from
Sep 7, 2018

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 @mui/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
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 component: toggle button This is the name of the generic UI component, not the React module! and removed package: lab Specific to @mui/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 component: toggle button This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants