-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
patch SelectControl with optgroups #28901
patch SelectControl with optgroups #28901
Conversation
update from base repo
I fixed a little bit of linting but `npm run lint` is giving me some errors that don't really have to do with this patch, the patch is simply preserving the current layout
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @JohnRDOrazio!. In case you missed it, we'd love to have you join us in our Slack community,where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
under `Props -> options`, explain that `value` can be either a scalar or an array.
@JohnRDOrazio, congrats on figuring out the build and everything you need to get this far! As I understand it the |
Thanks for your initial Pull request; I believe this has been implemented through #29540 (ref https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/select-control#development-guidelines) Please reopen if I am mistaken. |
Description
Added a conditional check whether the array of objects passed into
options
contain simple options or contain grouped options, so as to allow foroptgroup
s in the generatedSelectControl
.How has this been tested?
I have forked a copy of the Gutenberg repo, applied this patch, and then built the gutenberg plugin zip. I installed the zipped gutenberg plugin into a running WordPress instance, then created a SelectControl component in the InspectorTools for an example block in the Block editor. Here is how I created this SelectControl:
EXAMPLE 1: GROUPED OPTIONS
I also created a second example, combining top-level options with grouped options, and it is working correctly. Top-level options appear just fine alongside grouped options.
EXAMPLE 2: GROUPED OPTIONS with TOP-LEVEL OPTIONS
Screenshots
EXAMPLE 1
EXAMPLE 2
Types of changes
New feature : this patch enhances the SelectControl component so as to be more compliant with the html select input, allowing for optgroups.
Checklist:
Fixes #26505