twemoji-utils icon indicating copy to clipboard operation
twemoji-utils copied to clipboard

PNG size options not working on Safari

Open gustavwilliam opened this issue 3 years ago • 0 comments

The customisable PNG sizes (except for the standard 72x72) available from the download modal don't work on Safari. Screenshot 2021-11-25 at 22 10 25

Issue

We're using OffscreenCanvas to render the custom PNG sizes, from the source file SVGs. However, this isn't available on most browsers (including Safari and Firefox), since it's an experimental features. Here's the compatibility table from MDN (sorry for non-dark mode). Doesn't look great. Screenshot 2021-11-25 at 22 09 32

Solution

We should be able to render a "hidden" Canvas element at the bottom of the screen. It's important that the element isn't visible, or affects the layout of the page. This seems like the logical solution to me, but I'm open to other solutions as well.

Here's the most relevant file: https://github.com/gustavwilliam/twemoji-utils/blob/main/src/components/converterSvgToPng.js

gustavwilliam avatar Nov 25 '21 21:11 gustavwilliam