-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5: non-keyed each blocks do not retain text direction in elements with dir="auto"
#12193
Comments
dir="auto"
dir="auto"
To reproduce: Fav second item, click on on "Fav", see that non-keyed text changes direction |
I noticed that this doesn't occur on Firefox that's why I couldn't reproduce it on the REPL but it turns out it is reproducible on the REPL when using Chrome. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
If an element i.e. a
<p>
tag hasdir="auto"
attribute value, when Svelte replaces the elements after deleting/showing/hiding some of the elements, they do not retain the direction of the text instead it takes the direction of the element that Svelte replaced.There are two workarounds for this, one is to change it to a keyed each block, (but that also has some bugs where elements overlap each other and their order becomes messed up but I'm trying to narrow it down to open a bug If I have enough time for it as well) and the other is to use a useless
{#key}
block to force Svelte to re-render each item.Regardless of all this, the behavior of Svelte 4 is the correct behavior where the direction is always retained.
Reproduction
Out of Firefox and Chrome, It occurs on Chrome only for me.
To reproduce: Fav second item and then click on Fav button.
Notice that on the non-keyed each block the new element inherits the text direction of the element that was replaced therefore changing the direction.
Correct behavior: Svelte 4
Wrong behavior: Svelte 5
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: