Skip to content

Fix RTL styling on WordPress Core components - #1998

Merged
bcotrim merged 3 commits into
trunkfrom
stu-885-fix-rtl-styling-on-wordpress-core-components
Nov 4, 2025
Merged

Fix RTL styling on WordPress Core components#1998
bcotrim merged 3 commits into
trunkfrom
stu-885-fix-rtl-styling-on-wordpress-core-components

Conversation

@bcotrim

@bcotrim bcotrim commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Created WordPressStyles component using DynamicStylesheet to dynamically load WordPress component styles based on RTL/LTR direction
  • Updated DynamicStylesheet to insert styles at the beginning of head for proper CSS loading order
  • Fixed production CSS file paths to use relative paths from renderer HTML
  • Removed static WordPress CSS import from index.css in favor of dynamic loading

Testing Instructions

  • Run npm start
  • Switch language to RTL in settings
  • Verify WordPress components (modals, checkboxes) display correctly in RTL
  • Test in production build: Run npm run make and verify styles load correctly

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@bcotrim
bcotrim requested a review from a team November 3, 2025 22:13
@bcotrim bcotrim self-assigned this Nov 3, 2025
@github-actions

github-actions Bot commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

📊 Performance Test Results

Comparing b3678f4 vs trunk

site-editor

Metric trunk b3678f4 Diff Change
load 10907.00 ms 9529.00 ms -1378.00 ms 🟢 -12.6%

site-startup

Metric trunk b3678f4 Diff Change
siteCreation 15090.00 ms 15100.00 ms +10.00 ms 🔴 0.1%
siteStartup 4964.00 ms 4936.00 ms -28.00 ms 🟢 -0.6%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@ivan-ottinger ivan-ottinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing the issue with the broken RTL styles, Bernardo.

The proposed code looks good to me and works correctly. When a RTL local is set, the related WordPress Core components styles are being loaded as expected.

I have tested it in the dev and also built app.

The paddings around X button in the modal and around checkboxes is now correct.

Image Image

Just the unit tests need adjustment.

@epeicher epeicher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bcotrim for solving this! I have tested it in dev and production mode and it works as expected. I left a minor non-blocking comment. Code also LGTM! :shipit:

Image
id="wordpress-components-style"
href={ '../main_window/styles/wordpress-components-style.css' }
id="wordpress-components-style-error-fallback"
href={ './main_window/styles/wordpress-components-style.css' }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Should we apply the same logic for RTL for the errors than here https://github.com/Automattic/studio/pull/1998/files#diff-d47d7dfb85379fc920c32c6ccd0a9f5817e5104a1db25afd75a39b779fc5af70R22 ? 🤔 This is what I get

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Addressed in dbd0a59

@katinthehatsite katinthehatsite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me, I did not spot any regressions on my end 👌

@bcotrim
bcotrim merged commit 301bd40 into trunk Nov 4, 2025
11 checks passed
@bcotrim
bcotrim deleted the stu-885-fix-rtl-styling-on-wordpress-core-components branch November 4, 2025 15:40

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for fixing the RTL CSS issue! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants