Opened 3 years ago
Closed 2 years ago
#56325 closed defect (bug) (fixed)
Some blocks' RTL stylesheets not loading when RTL language is set
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | major | Version: | 6.0 |
Component: | Editor | Keywords: | has-patch needs-testing needs-unit-tests |
Focuses: | css, rtl | Cc: |
Description (last modified by )
When setting an RTL language under Settings > General, some RTL stylesheets are not loaded, meaning that some blocks are not displayed correctly.
To replicate
- Add navigation block to the header if there isn't one already
- Visit Settings > General
- Choose an RTL language
- View site on the front end
I tested with:
- Languages: Hebrew and Farsi
- WordPress 6.0.1
- No active plugins
Result
Some RTL stylesheets are not loaded; instead, the LTR stylesheets are loaded.
Examples of stylesheets being loaded:
/wp-includes/blocks/social-links/style.min.css?ver=6.0.1 /wp-includes/blocks/navigation/style.min.css?ver=6.0.1 /wp-includes/blocks/cover/style.min.css?ver=6.0.1
Expected
When selecting an RTL language, all appropriate RTL stylesheets should be loaded.
Examples of stylesheets that should be loaded:
/wp-includes/blocks/social-links/style-rtl.min.css?ver=6.0.1 /wp-includes/blocks/navigation/style-rtl.min.css?ver=6.0.1 /wp-includes/blocks/cover/style-rtl.min.css?ver=6.0.1
Note: These are three examples provided by the original reporter; there may also be other stylesheets not loading for other blocks.
Screenshots
Example of how the navigation menu looks with language set to Farsi is attached.
Report
Attachments (5)
Change History (18)
#1
@
3 years ago
- Component changed from Bundled Theme to Editor
- Description modified (diff)
- Keywords close added
Thanks for the report!
These are editor stylesheets, and the same occurs with the TT1 Blocks theme, so the report belongs on GitHub. Gutenberg issue 41649 seems similar, and I'll comment there to ask whether it's related.
#2
@
3 years ago
- Severity changed from normal to major
Please attention to this bug, Because all RTL web sites have problem in visibility of components
Thank you
#3
@
2 years ago
- Keywords has-patch needs-testing added; close removed
- Milestone changed from Awaiting Review to 6.0.2
- Summary changed from Twenty Twenty-Two: Some RTL stylesheets not loading when RTL language is set to Some RTL stylesheets not loading when RTL language is set
Farhad Sakhaei's PR 3096 modifies wp-includes/blocks.php, so we might be able to fix this apart from the plugin. (props farhad0)
The editor fetches the minified RTL stylesheets when I apply the patch's change to my WordPress 6.0.1 installation with Gutenberg deactivated and SCRIPT_DEBUG
set to false
.
#4
@
2 years ago
- Summary changed from Some RTL stylesheets not loading when RTL language is set to Some blocks' RTL stylesheets not loading when RTL language is set
#5
@
2 years ago
- Keywords needs-unit-tests added
Thanks for the patch!
If my understanding is correct, these lines can be added to an existing conditional a few lines below, see 56325.2.diff.
This would need a unit test for register_block_style_handle()
and could use some manual testing, so I'm not quite comfortable committing this just yet, but there is still some time before 6.0.2 comes next Tuesday.
#6
@
2 years ago
- Milestone changed from 6.0.2 to 6.1
Looks like this did not get any further traction yet. With 6.0.2 coming today, moving to 6.1 for now.
#7
@
2 years ago
Test Report
Env
- WordPress - 6.1-beta1-54282
- Chrome Version - 105.0.5195.125 (Official Build) (x86_64)
- OS - macOS Monterey V12.3.1
- Theme: Twenty Twenty Two
- PHP - 8.0.0
- Web Server - Apache
- Database - MySQL 5.7.28
- Used patch file - https://core.trac.wordpress.org/attachment/ticket/56325/56325.2.diff
- SCRIPT_DEBUG - false
Steps to test
- Add Navigation Block to the header
- Switch site to RTL language (Persian)
- Open site in front-end and view source.
- Check the source of CSS
- Apply the patch file, refresh page and check the CSS source.
- RTL CSS should load now.
Test result
- Performed some Manual Testing. RTL CSS is loading in RTL sites for navigation block after the patch.
Actual Results
- ✅ Issue resolved with patch.
Before Fix -
<link rel='stylesheet' id='wp-block-navigation-css' href='https://core.local/src/wp-includes/blocks/navigation/style.min.css?ver=6.1-beta1-54282-src' media='all' />
After Fix -
<link rel='stylesheet' id='wp-block-navigation-rtl-css' href='https://core.local/src/wp-includes/blocks/navigation/style-rtl.min.css?ver=6.1-beta1-54282-src' media='all' />
Thanks!
#10
@
2 years ago
- Owner set to SergeyBiryukov
- Status changed from new to accepted
Keeping the ticket open for now to add some unit tests.
Screenshot - Farsi