Skip to content

Conversation

@byseif21
Copy link
Contributor

@byseif21 byseif21 commented Jan 28, 2026

fix the limitation of dots effect wouldn't work correctly for ligature-based languages cuz connected letters cannot be rendered as individual dots.

before it was not worth the fix for the theme only now after the new typed effect feat #7360 i think this needed.

  • introduces a small helper that breaks ligatures only after a word is finished, allowing the dots effect to render correctly while keeping ligatures intact during typing.

  • runs only when needed (on word completion or when the typed effect is switched to dots) and avoids any continuous checks or performance overhead.

related #6472

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Jan 28, 2026
@byseif21 byseif21 marked this pull request as ready for review January 28, 2026 15:20
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Jan 28, 2026
@byseif21 byseif21 force-pushed the fix/dots-effect branch 2 times, most recently from ded97b2 to fb8df2e Compare January 28, 2026 16:18
"colorfulMode",
"showAllLines",
"fontSize",
"fontFamily",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now run updateWordWrapperClasses unnecessarily when a user changes fontFamily.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thing is I think I still need some of the layout updates it triggers when fontFamily changes. I’ll give it some manual testing to see

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this?

if (key !== "fontFamily"){
  updateWordWrapperClasses();
}
Ligatures.update(key, wordsEl);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kinda feel like fontFamily should also trigger updateWordWrapperClasses but can’t really prove it visually enough till now, so yeah ok I’ll leave it limited for now

if (shouldReset) {
words.forEach(reset);
}
words.forEach(applyIfNeeded);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if ok? or heavy and should we do batching instead?

Copy link
Contributor

@Leonabcd123 Leonabcd123 Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd do this:

words.forEach((word) => {
  if (shouldReset) reset(word);
  applyIfNeeded(word);
})

(not tested)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant performance wise

Copy link
Contributor

@Leonabcd123 Leonabcd123 Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance wise we're running on the words twice when shouldReset is true, while we can do it one pass. I don't see why go with this approach rather than doing it in one loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about batching then? too much or worth it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say it's worth it.

if (Config.typedEffect !== "dots") return false;
if (wordEl.hasClass("broken-ligatures")) return false;

return !!wordEl.native.closest(".withLigatures");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing with this:

return wordEl.getParent().hasClass("withLigatures");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? closest faster and better, getParent() creates a new ElementWithUtils object wrapper every single time

Copy link
Contributor

@Leonabcd123 Leonabcd123 Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closest seems less readable, as it doesn't make it clear what element might have the withLigatures class. Also (it might just be me), but I really hate the !! syntax.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do the spin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I lost, so keep current approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants