Skip to content

A platform for community discussion. Free, open, simple.

FIX: Serve RTL CSS for themes and components (#32916)

Osama Sayegh1de8960d2a57
diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rb
index 88d269ce24c..6b1bf8cca33 100644
--- a/lib/stylesheet/manager.rb
+++ b/lib/stylesheet/manager.rb
@@ -304,7 +304,7 @@ class Stylesheet::Manager
stylesheets = []
if is_theme_target
- scss_checker = ScssChecker.new(target, @theme_ids)
+ scss_checker = ScssChecker.new(target.to_s.delete_suffix("_rtl"), @theme_ids)
themes = load_themes(@theme_ids)
themes.each do |theme|
theme_id = theme&.id
diff --git a/spec/lib/stylesheet/manager_spec.rb b/spec/lib/stylesheet/manager_spec.rb
index 7c55dbebcb9..744c652b5e9 100644
--- a/spec/lib/stylesheet/manager_spec.rb
+++ b/spec/lib/stylesheet/manager_spec.rb
@@ -45,6 +45,16 @@ RSpec.describe Stylesheet::Manager do
end
end
+ it "generates RTL stylesheets for themes with components" do
+ manager = manager(theme.id)
+
+ hrefs = manager.stylesheet_details(:common_theme_rtl, "all")
+ expect(hrefs.size).to eq(2)
+ expect(hrefs.map { |href| href[:theme_id] }).to contain_exactly(theme.id, child_theme.id)
+ expect(hrefs[0][:new_href]).to start_with("/stylesheets/common_theme_rtl_")
+ expect(hrefs[1][:new_href]).to start_with("/stylesheets/common_theme_rtl_")
+ end
+
it "generates the right links for non-theme targets" do
manager = manager(nil)