-
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 support for some user supplied props in ColorGradientSettingsDropdown #60487
base: trunk
Are you sure you want to change the base?
Add support for some user supplied props in ColorGradientSettingsDropdown #60487
Conversation
props onDeselect and hasValue can be supplied by the user. if they're undefined or not a function, falls back to the default behavior.
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @permafrost06! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
Hi @permafrost06 https://developer.wordpress.org/block-editor/contributors/repository-management/#pull-requests |
@carolinan I don't think there is an open issue related to this PR. I faced this problem while developing a block and created this PR since the fix was quite simple. If you want, I can create an issue that illustrates what problem I faced or I can create a comment on the PR with more details. Please let me know which I should do. Thank you. |
Yes please open an issue since it is considered the best practice. |
@carolinan I have opened an issue #60536 that describes the problem this PR fixes. This PR adds support for the |
What?
In the
ColorGradientSettingsDropdown
component in@wordpress/block-editor
, propsonDeselect
andhasValue
can be supplied by the user. if they're undefined or not a function, falls back to the default behavior.Why?
The current behavior assumes that the default color value is empty - which isn't true sometimes. This small PR solves that.
How?
It checks whether or not the props
setting.onDeselect
andsetting.hasValue
for the componentColorGradientSettingsDropdown
are functions. If they are functions, then they are run respectively when a color is reset and to check if the control has a value.Testing Instructions
ColorGradientSettingsDropdown
component from@wordpress/block-editor
package.onDeselect
andhasValue
in a setting object. Example:Testing Instructions for Keyboard
Screenshots or screencast