Skip to content

Emoji: Replace subdivision and transgender flags when only the flag test fails - #13581

Open
Jiwoon-Kim wants to merge 1 commit into
WordPress:trunkfrom
Jiwoon-Kim:fix/63451-flag-fallback
Open

Jiwoon-Kim wants to merge 1 commit into
WordPress:trunkfrom
Jiwoon-Kim:fix/63451-flag-fallback

Conversation

@Jiwoon-Kim

Copy link
Copy Markdown

When a browser passes the emoji support test but fails the flag test, settings.supports.everythingExceptFlag is true and wp-emoji.js replaces only what matches its flag list: country flags (regional indicator pairs) and the rainbow and pirate flags. The flag test itself checks three sequences, the transgender flag, the Sark flag and the England flag, and the first and last of those are not on the list. So on a system that fails the test because of them, England, Scotland, Wales and the transgender flag are left to a font that cannot draw them; England shows as a plain black flag. That is the report in Core Trac #63451.

This adds the two missing kinds to the list:

  • subdivision flags, as Twemoji passes them to the callback: a black flag, tag characters and a cancel tag (1f3f4-e0067-e0062-e0065-e006e-e0067-e007f for England);
  • the transgender flag, 1f3f3-fe0f-200d-26a7-fe0f.

A black or white flag on its own is not a flag sequence and is still left as text, as before.

The bug is hidden at the moment because Core Trac #66104 makes the emoji test fail in every browser, so everything is replaced. Once Core Trac #66104 is committed, browsers that draw Emoji 17 but not these flags return to everythingExceptFlag, and the report comes back.

Testing: a new QUnit page, tests/qunit/wp-includes/js/emoji-flags.html, loads wp-emoji.js with everythingExceptFlag and checks, through wp.emoji.parse(), that country, England, Scotland, Wales, transgender, rainbow and pirate flags each become one image with the expected code, and that a non-flag emoji and a lone black flag stay text. With trunk's wp-emoji.js, 8 of its 16 assertions fail (England, Scotland, Wales and transgender); with this change all pass. The page is separate from the emoji.html page proposed in #13568 for Core Trac #66120, so the two pull requests do not touch the same test file. jshint passes on both changed scripts.

Trac ticket: https://core.trac.wordpress.org/ticket/63451

Use of AI Tools

This pull request was prepared with Claude Code (Anthropic). It read the flag test and replacement list, confirmed the icon codes by running Core's twemoji.js, wrote the fix and the QUnit tests, and ran the tests and lint checks locally.

…est fails.

With `everythingExceptFlag`, `wp-emoji.js` replaced only country, rainbow and pirate flags, although the flag support test also checks the transgender flag and the England flag. England, Scotland, Wales and the transgender flag were left as text a browser cannot draw.

Adds subdivision tag sequences and the transgender flag to the list, with a QUnit page covering each kind of flag.

See #63451.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props kimjiwoon.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

1 participant