mattboldt/typed.js

Animating emojis shows a rectangle before the emoji itself

sousa-andre opened this issue · 1 comments

Description

Animating strings that contain emojis shows a rectangle before showing the emoji itself.

Demo

JSFiddle Demo

Expected behavior: Show the animation without the rectangle.

Reproduces how often: Everytime

Additional Information

In JavaScript the length of the emojis (and some other unicode characters) is 2 meaning that when we call substring/slice on a string with an emoji we split the emoji code in half and thus it returns an invalid character. This problem can be easily fixed by replacing the substring calls within the source code by either Array.from(...).slice(...).join() or by through a library such as runes.

image

image

I'm ready to open a pull request with a fix but I would like to get some feedback on this first.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.