Commit e616a619920 for woocommerce
commit e616a6199202c325364f90dac625d7031585449a
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date: Mon Nov 16 19:06:31 2026 +0100
Make select elements in blocks follow global styles better (#70794)
* Add changelog file
* Make select elements in blocks follow global styles better
* Fix Product Categories block styles
* Reduce visual changes
* Decrease woocommerce-blocktheme.css specificity for selects
* Avoid clash with default WooCommerce CSS
* Add Purple styles
* Add changelog file
* Fix Validate changelog job in PRs that modify the themes directory
* Fix text-align
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5228ceb0fe0..71e573f2d46 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -98,7 +98,7 @@ jobs:
- '.github/workflows/ci.yml'
- '.github/workflows/phpstan.yml'
needs-changelog-validation:
- - '{packages,plugins}/*/!((changelog/*)|(readme.txt))'
+ - '{packages,plugins,themes}/*/!((changelog/*)|(readme.txt))'
needs-markdown-validation:
- '*.md'
- '!(.github/**)/**/*.md'
diff --git a/plugins/woocommerce/changelog/fix-select-specificity b/plugins/woocommerce/changelog/fix-select-specificity
new file mode 100644
index 00000000000..8687de70f1a
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-select-specificity
@@ -0,0 +1,4 @@
+Significance: patch
+Type: update
+
+Make select elements in blocks follow global styles better
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute/style.scss b/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute/style.scss
index bc3b19492fd..34b0f5d607b 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/variation-selector/attribute/style.scss
@@ -1,4 +1,4 @@
:where(.wp-block-woocommerce-add-to-cart-with-options-variation-selector-attribute .wc-block-dropdown__select) {
- height: 3em;
+ min-height: 3em;
padding: 0.25em 1em;
}
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/catalog-sorting/style.scss b/plugins/woocommerce/client/blocks/assets/js/blocks/catalog-sorting/style.scss
index 8e53d26f03d..db9741f0b2b 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/catalog-sorting/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/catalog-sorting/style.scss
@@ -9,23 +9,22 @@
vertical-align: middle;
}
- select.orderby {
- field-sizing: content;
- font-size: inherit;
- font-family: inherit;
- font-weight: inherit;
- font-style: inherit;
- letter-spacing: inherit;
- vertical-align: middle;
+ .woocommerce-ordering {
+ display: flex;
+ gap: 0.25em;
+ margin: auto;
}
- &.has-text-color {
- select.orderby {
- color: inherit;
- }
+ &.has-text-align-center .woocommerce-ordering {
+ justify-content: center;
}
- .woocommerce-ordering {
- margin: auto;
+ &.has-text-align-right .woocommerce-ordering {
+ justify-content: flex-end;
+ }
+
+ :where(select.orderby) {
+ field-sizing: content;
+ font-size: inherit;
}
}
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/product-categories/style.scss b/plugins/woocommerce/client/blocks/assets/js/blocks/product-categories/style.scss
index fccde4e2706..a6497dc43e2 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/product-categories/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/product-categories/style.scss
@@ -3,10 +3,11 @@
&.is-dropdown {
display: flex;
- }
+ gap: 0.5em;
- select {
- margin-right: 0.5em;
+ .wc-block-product-categories__dropdown {
+ display: contents;
+ }
}
}
diff --git a/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/sort-select/style.scss b/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/sort-select/style.scss
index 2c65b4f2f24..8acae812756 100644
--- a/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/sort-select/style.scss
+++ b/plugins/woocommerce/client/blocks/packages/public-api/blocks-components/sort-select/style.scss
@@ -7,8 +7,3 @@
display: inline-block;
font-weight: normal;
}
-
-.wc-block-components-sort-select__select {
- font-size: inherit;
- width: max-content;
-}
diff --git a/plugins/woocommerce/client/legacy/css/woocommerce-blocktheme.scss b/plugins/woocommerce/client/legacy/css/woocommerce-blocktheme.scss
index dc2ee341b94..08dd7e16f3e 100644
--- a/plugins/woocommerce/client/legacy/css/woocommerce-blocktheme.scss
+++ b/plugins/woocommerce/client/legacy/css/woocommerce-blocktheme.scss
@@ -222,7 +222,6 @@ a.added_to_cart {
*/
.woocommerce-page {
// Ensure text input fields aren't too small.
- select,
.input-text,
.select2-container {
font-size: var(--wp--preset--font-size--small);
@@ -233,6 +232,10 @@ a.added_to_cart {
}
}
+:where(.woocommerce-page select) {
+ font-size: var(--wp--preset--font-size--small);
+}
+
.woocommerce {
form {
diff --git a/themes/purple/changelog/fix-select-specificity b/themes/purple/changelog/fix-select-specificity
new file mode 100644
index 00000000000..a7b0c70fb5b
--- /dev/null
+++ b/themes/purple/changelog/fix-select-specificity
@@ -0,0 +1,4 @@
+Significance: patch
+Type: add
+
+Add minimalistic select element styles
diff --git a/themes/purple/package.json b/themes/purple/package.json
index 1cb803abe3f..41bc6c38c72 100644
--- a/themes/purple/package.json
+++ b/themes/purple/package.json
@@ -23,7 +23,7 @@
],
"scripts": {
"validate": "pnpm --filter=@woocommerce/theme-cli validate purple",
- "changelog": "composer exec -- changelogger",
+ "changelog": "XDEBUG_MODE=off composer install --quiet && composer exec -- changelogger",
"env:start": "pnpm --filter=@woocommerce/theme-cli wp-env start purple",
"env:stop": "pnpm --filter=@woocommerce/theme-cli wp-env stop purple",
"build": "pnpm --filter=@woocommerce/theme-cli build purple"
diff --git a/themes/purple/theme.json b/themes/purple/theme.json
index 49b7ff1d87e..fb23ece368a 100644
--- a/themes/purple/theme.json
+++ b/themes/purple/theme.json
@@ -562,23 +562,16 @@
},
"elements": {
"select": {
- "color": {
- "background": "transparent",
- "text": "var(--wp--preset--color--theme-2)"
- },
"border": {
"color": "transparent",
- "width": "0px",
- "style": "solid"
- },
- "typography": {
- "fontWeight": "300",
- "fontFamily": "inherit"
+ "width": "0px"
},
"spacing": {
"padding": {
- "left": "0",
- "right": "var(--wp--preset--spacing--10)"
+ "top": "0",
+ "right": "var(--wp--preset--spacing--10)",
+ "bottom": "0",
+ "left": "0"
}
}
}
@@ -763,6 +756,31 @@
"border": {
"color": "var(--wp--preset--color--theme-6)"
}
+ },
+ "select": {
+ "color": {
+ "background": "transparent",
+ "text": "var(--wp--preset--color--theme-2)"
+ },
+ "border": {
+ "color": "color-mix(in srgb, currentColor 30%, transparent)",
+ "radius": "0",
+ "width": "1px",
+ "style": "solid"
+ },
+ "typography": {
+ "fontSize": ".875em",
+ "fontWeight": "300",
+ "fontFamily": "inherit"
+ },
+ "spacing": {
+ "padding": {
+ "top": "var(--wp--preset--spacing--10)",
+ "left": "var(--wp--preset--spacing--10)",
+ "bottom": "var(--wp--preset--spacing--10)",
+ "right": "var(--wp--preset--spacing--10)"
+ }
+ }
}
},
"spacing": {