RTL styles stripped out by Svelte compiler if dir="rtl"
is outside of component (always)
#507
Labels
Milestone
dir="rtl"
is outside of component (always)
#507
Describe the bug
dir="rtl"
will almost always be set pretty close to the document body element (ie - outside of the Svelte component at hand), so when svelte-windicss-preprocessor sees anrtl
class likertl:left-2
it will put[dir='rtl'] .rtl\:left-2
and[dir='rtl'].rtl\:left-2
into the style block which will promptly be removed by the svelte compiler (and it will give you a notice) as those scoped classes will never be used. In order for rtl classes to ever work in this context this preprocessor needs to write them as:global([dir='rtl'] .rtl\:left-2)
and:global([dir='rtl'].rtl\:left-2)
.Note that there's an edge case scenario in which this could break some users' layouts if they use
rtl:hidden rtl:md:block
in one component and thenrtl:hidden
in a component whose styles get added to the DOM later on - the problem is that the latterrtl:hidden
class styles will override the expectedrtl:md:block
styles.System Info
Used Package Manager
pnpm
The text was updated successfully, but these errors were encountered: