Commit 5b04a494dab for woocommerce
commit 5b04a494dab9fb417e41e1bd7286986c9b45cfc1
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date: Fri Aug 7 13:54:04 2026 +0200
Update coding guidelines to prefer using logical CSS properties over physical ones (#67455)
* Update coding guidelines to prefer using logical CSS properties over physical ones
* Add changelog
* Minor changes
* Use better examples
diff --git a/AGENTS.md b/AGENTS.md
index fac82563afb..d5ad57b4352 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -78,6 +78,10 @@ plugins/woocommerce/
- Prefer vanilla JavaScript/TypeScript over jQuery for new or modified code. Keep existing jQuery when a rewrite is out of scope.
+**CSS:**
+
+- Prefer logical CSS properties that work well in LTR and RTL languages like `margin-inline-start`, or `inset-inline-end`, instead of physical properties like `margin-left` or `right`.
+
## Development Workflow
1. Make code changes
diff --git a/plugins/woocommerce/changelog/update-coding-guidelines-css-logical-properties-over-physical-ones b/plugins/woocommerce/changelog/update-coding-guidelines-css-logical-properties-over-physical-ones
new file mode 100644
index 00000000000..7dfe88effb9
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-coding-guidelines-css-logical-properties-over-physical-ones
@@ -0,0 +1,5 @@
+Significance: patch
+Type: dev
+Comment: Update coding guidelines to prefer using logical CSS properties over physical ones
+
+
diff --git a/plugins/woocommerce/client/blocks/docs/contributors/coding-guidelines.md b/plugins/woocommerce/client/blocks/docs/contributors/coding-guidelines.md
index e435df629af..e763bcb65a5 100644
--- a/plugins/woocommerce/client/blocks/docs/contributors/coding-guidelines.md
+++ b/plugins/woocommerce/client/blocks/docs/contributors/coding-guidelines.md
@@ -68,31 +68,9 @@ Naming is not strictly tied to the DOM so it **doesn’t matter how many nested
## RTL Styles
-Blocks uses the internal `WebpackRTLPlugin` exported from `@woocommerce/internal-build/style-build` to generate styles for Right-to-Left languages. These are generated automatically.
+Prefer logical CSS properties that work well in LTR and RTL languages like `margin-inline-start`, or `inset-inline-end`, instead of physical properties like `margin-left` or `right`.
-To make adjustments to the generated RTL styles, for example, excluding certain rules from the RTL stylesheets, you should use the [control directives here](https://rtlcss.com/learn/usage-guide/control-directives/index.html).
-
-For example, you can exclude individual lines:
-
-```css
-.code {
- /*rtl:ignore*/
- direction: ltr;
- /*rtl:ignore*/
- text-align: left;
-}
-```
-
-Or exclude blocks of CSS:
-
-```css
-.code {
- /*rtl:begin:ignore*/
- direction: ltr;
- text-align: left;
- /*rtl:end:ignore*/
-}
-```
+Even though Blocks uses the internal `WebpackRTLPlugin` exported from `@woocommerce/internal-build/style-build` to generate specific CSS files for RTL languages, these might not be used if Gutenberg inlines the styles, so it shouldn't be trusted.
## SCSS File Naming Conventions for Blocks