talkjs / country-flag-emoji-polyfill

Add country flag emojis to Chromium-based browsers on Windows
Other
122 stars 8 forks source link

Display bug #10

Closed fabswt closed 7 months ago

fabswt commented 7 months ago

I'm the author of gliglish.com where I use the polyfill to display country flags on Windows too. I've been experiencing the following bug:

Observed behavior

flag-issue-1 flag-issue-2 flag-issue-4 flag-issue-5-mobile
is-emoji-supported.js:47 Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

Expected behavior

Would expect the flags to render fine at all times – in particular on Mac where the polyfill does not kick in.

Platform

This is on Mac using Chrome Version 119.0.6045.199 (Official Build) (arm64). I don't think I had the issue until weeks ago even though I've been using the polyfill for several months. So this might be a new browser thing.

eteeselink commented 7 months ago

Woa this is nuts indeed! Can you confirm that the problem goes away when you remove the polyfill? Like you describe, I'm a bit baffled as to how this affects Mac at all.

That console message is new to me too, but I'm not 100% convinced yet that it causes the bug you experience. It warns that the emoji detection routine is slow, but that shouldn't affect its result, right? Unless of course the warning text is incorrect and actually it somehow errors out in a way that makes the polyfill interprets as "ok this browser supports regular emojis but not country flags", but that feels weird to me.

Reading the spec, it's about whether canvas pixels are stored in GPU or CPU memory, and the two canvases the polyfill reads the pixels out of are so small that there shouldn't be a measurable difference at all. Either way, I'll see if I can address that warning, but please meanwhile check that the bug you experience is related to the polyfill. I don't have a mac handy so can't easily reproduce.

eteeselink commented 7 months ago

Hey @fabswt I published a new version (0.1.5) which removes the warning. I had to replace the emoji detection library by custom (but, I think, better) code. Can you let me know whether the warning is gone for you, too?

I still vaguely fear that the mac disappearing flag problem isn't related to this change though, would love to know whether this version changes anything and, if not, whether removing the polyfill affects the situation.

fabswt commented 7 months ago

Hey @eteeselink ! I think this did the trick. I didn't do anything on my end, using the latest from the CDN, and both the issue and the warning are gone.

Thank you very much! :)