Skip to content
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

Sparkles make words jump (on small screen sizes) #2

Open
eQRoeil opened this issue Dec 5, 2023 · 3 comments
Open

Sparkles make words jump (on small screen sizes) #2

eQRoeil opened this issue Dec 5, 2023 · 3 comments

Comments

@eQRoeil
Copy link

eQRoeil commented Dec 5, 2023

When sparkles appear / disappear they make words jump to the next line (and back)

captures (around 430px viewport width, chrome desktop) same on android device (412px viewport with)

chrome bug it seems, as the span & svg are positioned (absolute) they should not make siblings move.
firefox & safari mac do not seem to be affected.

note : a sparkle may appear at the end of an empty line (when one word go to next line)
a solution might be to not place with top & left but create a span for each word and place randomly the sparkle wrapper between the spans.

sparkles1

sparkles2

sparkles3

@stefanjudis
Copy link
Owner

Thanks for the bug report. :)

When sparkles appear / disappear they make words jump to the next line (and back)

Unfortunately, I fail to reproduce this one.

A solution might be to not place with top & left but create a span for each word and place randomly the sparkle wrapper between the spans.

Yeah, I see how an inline element spanning multiple lines leads to surprising behavior. I'm not sure about injecting spans though. Ideally, <sparkly-text /> works in multiple scenarios.

Two quick examples I could think of:

<sparkly-text><strong>a word</strong></sparkly-text>
<strong><sparkly-text>a word</sparkly-text></strong>

Not sure, if injecting spans wouldn't introduce corner cases. 🤔

@eQRoeil
Copy link
Author

eQRoeil commented Dec 5, 2023

can reproduce with chrome 119 & 121 (canary) on mac

sparkles.mp4

fun experiment to make with spans, I will try something

@stefanjudis
Copy link
Owner

stefanjudis commented Dec 5, 2023

Thanks for the repo. :) Yeah this indeed looks like a browser bug. 🫣

fun experiment to make with spans

I thought a bit more about it and I think I might have changed my mind. The element is called sparkly-text so I think it'd be easier to enforce a text node and throw if there are other elements in a <sparkly-text /> and just ship v2. 😅

I will try something

Cool! Then I'll wait a bit. And no pressure — any help is greatly appreciated. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants