Opened 10 months ago
Closed 6 months ago
#63555 closed enhancement (fixed)
Backport Global Styles: add support for select or dropdown elements
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | has-patch has-test-info dev-feedback gutenberg-merge |
| Focuses: | Cc: |
Description (last modified by )
This PR adds a new class that can be used by themers and extenders to style selects or dropdown elements. Right now the experimental form block doesn't have dropdowns in it, but many extenders do, so I wanted to cover them too in line with the work being done at https://github.com/WordPress/gutenberg/pull/70378/
We are adding a new class wp-element-select the same way we do for the button element, since it's less disruptive than styling the select element directly and can be slowly adopted by plugins as they see fit
This one is a little hard to test without having a native block that has a dropdown in it. What I did was:
- alter a third party block to have the wp-element-select class.
- added the following to my theme.json file:
"elements": {
"select": {
"color": {
"text": "red",
"background": "blue"
}
},
}
Change History (15)
This ticket was mentioned in PR #8961 on WordPress/wordpress-develop by @onemaggie.
10 months ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core-test by oglekler. View the logs.
10 months ago
#4
@
10 months ago
- Keywords has-test-info added
Test Report
Description
✅ This report validates that the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/8961.diff
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-Three 1.6
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
- WooCommerce 9.9.3
Testing Instructions
- Install WooCommerce
- Add some mock data (some products)
- Edit
woocommerce/src/Blocks/BlockTypes/CatalogSorting.php. Around line 39 add something like:$catalog_sorting = $this->add_wp_element_select_class( $catalog_sorting );
This will add the wp-element class to the Catalog Sorting Block
- Set a block theme like 2023
- Go to the Widgets Section and add a Catalog Sorting Block to the Sidebar, for example.
- Edit the
theme.jsonof 2023 theme and add in theelementssection, some colours like described in the OP, mocking Gutenberg's behaviour.
Expected Results
- Select should take the colours indicated
Actual Results
- ✅ Colours appear with the patch
Supplemental Artifacts
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
10 months ago
#6
@
10 months ago
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/8961.diff
Testing instructions followed from #comment:4
By manually adding wp-element-select class to WooCommerce CatalogSorting block on line 47 at woocommerce/src/Blocks/BlockTypes/CatalogSorting.php inside render() method
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 138.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Three 1.6
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
- WooCommerce 9.9.5
Actual Results
- ✅ Can style
selectcolors withtheme.json
Supplemental Artifacts
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
10 months ago
#8
@
10 months ago
Test Report
Description
This report validates whether the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/8961
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 138.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.2
- MU Plugins: None activated
- Plugins:
- Example Static 0.1.0
- Test Reports 1.2.0
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
theme.json current schema needs to be updated to allow select as a valid property in elements as currently it says select is not allowed.
Supplemental Artifacts
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
9 months ago
#10
@
9 months ago
- Keywords dev-feedback added
6.9.0 Milestone proposed during today's <bug-scrub>
More information
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
9 months ago
#12
@
6 months ago
- Keywords gutenberg-merge added
- Milestone changed from Awaiting Review to 6.9
This ticket is a backport from Gutenberg and should be addressed in the 6.9 release.




Backport for https://github.com/WordPress/gutenberg/pull/70379
## What?
Part of https://github.com/WordPress/gutenberg/issues/34198
This PR adds a new class that can be used by themers and extenders to style selects or dropdown elements. Right now the experimental form block doesn't have dropdowns in it, but many extenders do, so I wanted to cover them too in line with the work being done at #70378
## Why?
So a theme can style consistently how forms should look like regardless of the plugins installed (if they opt in this new API)
## How?
We are adding a new class
wp-element-selectthe same way we do for the button element. Discussion on the closed https://github.com/WordPress/gutenberg/issues/70068 led me to the opt in solution, since it's less disruptive and can be slowly adopted by plugins as they see fit## Testing Instructions
This one is a little hard to test without having a native block that has a dropdown in it. What I did was:
wp-element-select."elements": { "select": { "color": { "text": "red", "background": "blue" } }, }Trac ticket:
https://core.trac.wordpress.org/ticket/63555