[wp-trac] [WordPress Trac] #61625: Styles enqueued from block.json are not correctly configured for RTL
WordPress Trac
noreply at wordpress.org
Wed Jul 10 20:51:18 UTC 2024
#61625: Styles enqueued from block.json are not correctly configured for RTL
---------------------------+-----------------------------
Reporter: ryelle | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version:
Severity: normal | Keywords:
Focuses: rtl |
---------------------------+-----------------------------
When viewing a site using an RTL language, the RTL CSS files are not
loaded for custom blocks using block.json. For example, a block might say
`"style": "file:./style-index.css"`, which is then loaded as-is on LTR
sites. On RTL sites, the `style-index.css` file is still loaded, despite
`style-index-rtl.css` existing.
This seems to be due to the `register_block_style_handle` function — it
does correctly add data for the RTL file, `style-index-rtl.css`, but it
also adds a `suffix` value (when `SCRIPT_DEBUG = false`).
When the style tag is printed, WP tries to update the file's url to the
RTL file, but it's searching for `.min.css` to replace, and that isn't the
right filename. The url is not updated, so it still loads the LTR `style-
index.css`.
This can be replicated with the default `create-block` block, I've also
created a simple demo plugin to explain: https://github.com/ryelle/rtl-
style-example
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61625>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list