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

Emoji Mart: Update to Emoji 15 #24

Merged
merged 8 commits into from
Jan 11, 2024

Conversation

ngainsboro-figma
Copy link

@ngainsboro-figma ngainsboro-figma commented Jan 9, 2024

What is this PR?
Upgrade our emoji version to 15! This is prep work to help the Figjam team do a larger Emoji upgrade. As part of their work, they will be supporting Emoji 15 in the fonts for both Figma Design and Figjam. The plan is to put this upgrade behind a Feature Flag in web/Sinatra.

Where did we get Emoji 15 data?
The emoji-mart package hasn't been updated in 2 years :'( However, a community member created a PR updating the JSON files.

  1. Grabbed the raw JSON files form Add the emoji version 15.0 to emoji-mart/data missive/emoji-mart#844
  2. Ran the following to update it into our expected JSON format for each of the 5 sets:

with open('native.json', 'r') as f1:
    data = json.load(f1)

for emoji in data['emojis']:
    data['emojis'][emoji] = data['emojis'][emoji]['skins']
    new_li = []
    for di in data['emojis'][emoji]:
        new_li.append({'unified': di['unified']})
    data['emojis'][emoji] = new_li

with open('native.json', 'w') as f2:
    f2.write(json.dumps(data))
  1. Finally ran npm run build to update index.js with the changes.

Testing

  • Fixed automatic tests
  • Pointed to the last commit on this PR in a local web build, ran pnpm install in the web/ directory, then confirmed I could now add :shaking_face: and a couple of other Emoji 15 emoji
image

Expected since the fonts for figjam aren't updated to emoji 15 yet
image

Asana: https://app.asana.com/0/1200108292617599/1206305217276090/f

@ngainsboro-figma ngainsboro-figma marked this pull request as ready for review January 9, 2024 18:39
@@ -25,6 +25,6 @@ export default class PickerElement extends ShadowElement {
}
}

if ('customElements' in window && !customElements.get('em-emoji-picker')) {
customElements.define('em-emoji-picker', PickerElement)
if ('customElements' in window && !customElements.get('em-emoji-picker-15')) {
Copy link
Author

Choose a reason for hiding this comment

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

This was a wonky quirk. Basically, this customElements is globally spaced, but we'll be importing the old and new version of emoji-mart while it's under FF. To avoid a react error, we can just register this under a slightly modified name.

Choose a reason for hiding this comment

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

Will you have two entries in Figma's package.json pointing to two different shas?

Copy link
Author

Choose a reason for hiding this comment

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

@@ -25,6 +25,6 @@ export default class PickerElement extends ShadowElement {
}
}

if ('customElements' in window && !customElements.get('em-emoji-picker')) {
customElements.define('em-emoji-picker', PickerElement)
if ('customElements' in window && !customElements.get('em-emoji-picker-15')) {

Choose a reason for hiding this comment

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

Will you have two entries in Figma's package.json pointing to two different shas?

@@ -16,7 +16,7 @@ describe('Data', () => {

test('emojis', () => {
expect(Data).toHaveProperty('emojis')
expect(Object.keys(Data.emojis).length).toBe(1849)
expect(Object.keys(Data.emojis).length).toBe(1870)
Copy link

@oliw-figma oliw-figma Jan 10, 2024

Choose a reason for hiding this comment

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

interesting I thought the new emoji count would be higher!

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, small update: https://emojipedia.org/emoji-15.0

Comment on lines -30 to -37
const MISSING_ALIAS = {
// Figma's beetle emoji renders as a ladybug, which is complicated because
// beetle was introduced as a new emoji in v13 with a different image
// For now, we continue to honor our old, now incorrect shortcode. We will
// want to revisit this when we upgrade what emoji version we support
beetle: 'ladybug',
man_in_tuxedo: 'person_in_tuxedo',
}

Choose a reason for hiding this comment

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

If you have the time, can you elaborate why this is safe to remove? I can't quite infer what the original issue was (and why updating emoji sets fixes it) looking at the comment getting ripped out.

Copy link
Author

Choose a reason for hiding this comment

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

In the before times (6+ years ago), we special-cased these 2 emoji. As part of the emoji 14 upgrade, we got the product go-ahead to stop special-casing them. I think it was before the ladybug emoji was introduced. I had stripped out all of those use cases from our code except for this one (see the last subtask here: https://app.asana.com/0/1204728196943613/1205011813641107/f). I had deprioritized it, but since I was in here anyways figured I may as well remove it.

So this is a (small) change in user experience, but an intentional green-lit one.

@ngainsboro-figma ngainsboro-figma merged commit 3f99397 into figma-release-3 Jan 11, 2024
2 checks passed
@ngainsboro-figma ngainsboro-figma deleted the ngainsboro/emoji-15-upgrade branch January 11, 2024 22:02
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

Successfully merging this pull request may close these issues.

2 participants