Skip to content

Respect requested text presentation of emojis

Current problem

Emojis can be rendered in two variants.

Text presentation Emoji-style
😊︎ 😐︎ ☹︎ 😊️ 😐️ ☹️

The variants defaults to the emoji-style one but the user can specify a variant by following the emoticon character by a Unicode “VARIATION SELECTOR”. There are two variation selectors (taken from Wikipedia):

  • U+FE0E (VARIATION SELECTOR-15) selects text presentation
  • U+FE0F (VARIATION SELECTOR-16) selects emoji-style

Read more about that in this Wikipedia article.

When you write an emoji and use the VARIATION SELECTOR-15, GitLab should show the text-style, however it currently renders both as a gl-emoji.

Expected Acutal
image image

Solution

This MR makes tanuki_emoji respect the variation selector and not detect emojis that are followed by U+FE0E (VARIATION SELECTOR-15). As a future iteration, tanuki_emoji could perhaps detect the emoji but only when requested by the developer. This would require more work on GitLab though.

Related to gitlab-org/gitlab#219622

How to test

Once tanuki_emoji is updated downstream in gitlab-org/gitlab, you can test it like this:

  1. Go to an issue
  2. Edit the description
  3. Paste 🐶
  4. Press Enter twice
  5. Paste 🐶
  6. Open following page in a new tab: U+FE0E
  7. Click on Copy to Clipboard
  8. Switch the tab back to your issue
  9. Paste the copied character
  10. Save the description
  11. See that the emojis are rendered differently (first: emoji-style, second: text-style)
Edited by Kev

Merge request reports