-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add panel button props #28147
Add panel button props #28147
Conversation
Size Change: +1.99 kB (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
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.
Hey @joshuatf - thanks for working on this.
What is the reason for wanting this? Because your example is about disabled
which isn't so common I think. For example I think we wouldn't render a Panel at all instead of disabling it.
Having said that, if there are use cases, I think we shouldn't name it buttonProps
and at the end of destructure in PanelBody
we should gather all the rest properties like this: ...props
and then pass them on to PanelBodyTitle
that applies them in the Button
.
Thanks for the review @ntsekouras. We’re using these props in the linked PR above ( woocommerce/woocommerce-admin#5970 ) to disable a toggle that has no content. This is both an accessibility issue and UI issue for us. I can't speak to how common this is, but preventing an empty panel from being toggled is better in our case than simply removing the panel body. I can see other use cases for this as well, such as passing custom I’m not sure renaming this to |
Hey @joshuatf - we can go with |
Good call @ntsekouras, added in f807042. |
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.
Thanks! 👍
Description
Adds
buttonProps
toPanelBody
to allow modifying the button state/props for panel toggles.How has this been tested?
Verified manually via storybook and added tests for addition of props.
npm run storybook:dev
Screenshots
Checklist: