Notes: Try a WPDS-built emoji picker (alternative to Frimousse)#78129
Conversation
Build the full emoji picker from WordPress components (SearchControl
+ Composite) instead of pulling in Frimousse, while still sourcing
emoji data from Emojibase. The previous implementation showed all UI
chrome in English regardless of the site language because Frimousse
draws its strings from Emojibase's .po files, which are not on
GlotPress and don't cover every WordPress locale.
The new picker:
- Uses __() for all UI chrome strings ("Search emoji", "Loading…",
"No emoji found.") so GlotPress can translate them for every
WordPress locale.
- Detects the site language from `<html lang>` and fetches the
matching Emojibase locale (28 supported), falling back to English
for locales Emojibase doesn't translate. Emoji labels and category
names come from those per-locale data.json/messages.json files.
- Ships all 28 Emojibase locales via build/emojibase-data/; only the
active locale is fetched per editor session (~85KB gzipped).
- Drops the frimousse npm dependency.
Replicates Frimousse's surface: search, sticky-header categorized
grid, 8-column layout, loading/empty states, keyboard navigation
(via Composite). All 38 block-notes E2E tests pass against the new
picker.
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
Size Change: -5.93 kB (-0.08%) Total Size: 7.83 MB 📦 View Changed
ℹ️ View Unchanged
|
Summary
Alternative to #76767 that drops the Frimousse dependency and builds the full emoji picker from existing WordPress components. Same UX, same Emojibase data, full GlotPress translation coverage for the chrome.
This PR is opened against the Frimousse branch so the diff highlights only the picker swap. Easy to compare: same feature, two implementations.
Why
Per @t-hamano's review on #76767: Frimousse's UI text comes from Emojibase's
.pofiles, which aren't on GlotPress and don't cover every WordPress locale. Users on locales Emojibase doesn't translate would see chrome strings in English.What changed
frimoussenpm packageSearchControl+Compositefrom@wordpress/componentsSearch emoji,Loading…,No emoji found.)__()→ GlotPress, every WP locale<html lang>frimoussedependencybuild/emojibase-data/en/build/emojibase-data/{28 locales}/Per-session network cost stays at one locale (~85KB gzipped), only fetched when the user opens the + picker for the first time in a session.
Architecture
packages/editor/src/components/collab-sidebar/emoji-picker.js(new):resolveEmojibaseLocale()maps a BCP-47 / WordPress locale string (pt-BR,fr_FR,zh-TW) to the closest of Emojibase's 28 locales, falling back toen.useEmojibaseData(baseUrl, locale)fetchesdata.json+messages.jsononce per locale, with module-level cache and abort-on-unmount.<EmojiPicker>rendersSearchControlover aCompositegrid grouped by Emojibase category, with sticky headers andcontent-visibility: autoper-row so all ~1949 emojis render quickly.The PHP shim (
lib/compat/wordpress-7.1/emojibase-data.php) and thewindow.gutenbergEmojibaseUrlmechanism are unchanged.Tradeoffs
Pros
packages/editor/, no new build steps.Cons
build/emojibase-data/(still ~7MB on disk, none of it shipped to the browser per session).content-visibility: auto. Acceptable for ~250 rows; can revisit if it shows up in profiles.Test plan
npm run test:e2e -- test/e2e/specs/editor/various/block-notes.spec.js)lint:jscleannpm run buildclean; copy script populates 28 locale directoriesComparison
Reviewers who want to A/B the implementations:
add-notes-emoji-reactions-try-addditional-comment-type(PR Notes: Add emoji reactions - stored as custom comment type #76767)The diff between them is exactly the contents of this PR.