Skip to content

Notes: Add filters to customize emoji reactions - #84043

Open
adamsilverstein wants to merge 18 commits into
try/notes-emoji-picker-autocomplete-gridfrom
try/notes-emoji-reaction-filters
Open

adamsilverstein wants to merge 18 commits into
try/notes-emoji-picker-autocomplete-gridfrom
try/notes-emoji-reaction-filters

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Test in WordPress Playground

Split out of #83538 to keep that PR reviewable - this adds the filters for customizing emoji reactions on top of it, to review once the core picker lands. Updated to pick up the review feedback from the smaller filter in #84200.

Claude carried the #84200 feedback over and refreshed this write-up:

What?

Stacked on #83538. Adds two filters that let a site shape emoji reactions on Notes:

  • gutenberg_note_reaction_emoji_settings - the named emoji that seed "Frequently used", carry their own labels, and are always accepted, plus allow_unlisted (false limits reactions to the named list) and exclude (hex keys to reject, along with their skin-tone variants and any longer sequence that contains them).
  • gutenberg_emoji_picker_label_overrides - labels for emoji in locales Emojibase does not translate, seeded with the named list.

The picker only offers what the REST API accepts, so both sides read the same settings.

Why?

These were part of #83538, where they made up a large share of the diff while being an optional extension point. Moving them here lets #83538 focus on the picker and the reaction storage.

How?

  • Named emoji use the same entry shape as the wp_note_reaction_emojis filter in Notes: Add a filter for the limited preset emoji reaction list #84200: array( 'hex_key' => '1f984', 'label' => 'Unicorn' ). Case does not matter and U+FE0F is dropped, so an Emojibase hexcode such as 2764-FE0F works as is.
  • The filter code lives in lib/compat/wordpress-7.3/note-reactions.php and is tagged @since 7.3.0. WordPress 7.2 ships the fixed list of seven reactions, so this is 7.3 material.
  • gutenberg_normalize_note_reaction_key() is the same function Notes: Add a filter for the limited preset emoji reaction list #84200 adds, so whichever PR lands second drops its copy. It now also rejects surrogates and values past U+10FFFF, and handles over-padded code points (000A9 becomes 00a9).
  • Named entries with an empty label or a repeated key are dropped, and labels run through sanitize_text_field().
  • The server passes noteReactionEmojis, noteReactionEmojiRules, and noteEmojiLabelOverrides through the block editor settings; the editor reads them for the "Frequently used" seeds, the grid filter, and labels in the picker and the reaction pills.
  • The controller runs a valid hex key through gutenberg_is_note_reaction_key_allowed() before accepting it.
  • An excluded emoji is now rejected anywhere in a key, not only as the whole key. Before, a direct REST request could append a code point that does not change how the emoji renders (eg. 1f44e-fe0e) and get it accepted. The trade-off: excluding an emoji also excludes ZWJ sequences built on it.
  • Bug fix: noteReactionEmojiRules was set server-side but missing from the BLOCK_EDITOR_SETTINGS allowlist in use-block-editor-settings.js, so the editor never received the rules and the picker offered emoji the REST API then rejected. That fix is its own commit, with an e2e test that an excluded emoji is not offered.

Open question

This PR and #84200 both let a site define the list of named reactions, through two different filters. If #84200 lands first, the named list here could come from wp_note_reaction_emojis, leaving gutenberg_note_reaction_emoji_settings with only allow_unlisted and exclude. Not done here yet, since it depends on which PR goes in first.

Testing Instructions

  1. Add a filter, eg. in a mu-plugin:
    add_filter( 'gutenberg_note_reaction_emoji_settings', function ( $settings ) {
        $settings['emojis'][]  = array( 'hex_key' => '1f984', 'label' => 'Unicorn' );
        $settings['exclude'][] = '1f44e';
        return $settings;
    } );
  2. Add a note to a block and open the "Add reaction" picker. "Unicorn" shows in "Frequently used" next to the seven defaults.
  3. Search "thumbs down"; nothing is offered. Search "thumbs up"; it is still there.
  4. React with the unicorn; the pill shows 🦄 and its tooltip says "Unicorn".
  5. Change the filter to set allow_unlisted to false; the picker only offers the named emoji.

Tested locally: PHPUnit (Emoji_Picker_Data_Test, Tests_Note_Reactions_Feed, WP_Test_REST_Comments_Controller_Gutenberg) 113 pass, the reaction unit tests 16 pass, and PHPStan, PHPCS, ESLint and the typecheck are clean. The "Emoji Reactions" e2e tests were not rerun locally after this update, so those are left to CI.

AI Use

Code and description both came out of a few rounds with 🤖 Claude Code, including this update. I will review and test.

🤖 Generated with Claude Code

https://claude.ai/code/session_018vwYjSFEhWEs8GA798tZbi

adamsilverstein and others added 2 commits October 2, 2026 17:07
Let sites shape note reactions through two filters:

- `gutenberg_note_reaction_emoji_settings` sets the named emoji that
  seed "Frequently used" and are always accepted, and limits or
  excludes every other emoji with `allow_unlisted` and `exclude`. The
  picker only offers what the REST API accepts.
- `gutenberg_emoji_picker_label_overrides` labels emoji for locales
  Emojibase does not translate, seeded with the named list.

Named emoji are identified by their Emojibase hexcode, matching how
every reaction is stored, so no UTF-8 decoding is needed server-side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZXqJi4dn3qcNsYZHa579m
The server sets noteReactionEmojiRules, but the block editor settings
allowlist dropped it, so the picker always saw the default rules and
offered emoji the REST API rejects, such as one a site excluded. Add
it to the allowlist, with an e2e test that an excluded emoji is no
longer offered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZXqJi4dn3qcNsYZHa579m
@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] E2E Tests /packages/e2e-tests labels Oct 3, 2026
The new editor settings are part of the package's public surface, so
note them for consumers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZXqJi4dn3qcNsYZHa579m
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: +507 B (+0.01%)

Total Size: 8.74 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 588 kB +507 B (+0.09%)

8a70d11 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 96b0b72 try/notes-emoji-picker-autocomplete-grid % Change
timeToFirstByte 44.85 ms +7.02% -4.12% 45.35 ms +6.62% -2.98% -1.1%
largestContentfulPaint 68 ms +8.82% -5.88% 72 ms +13.89% -5.56% -5.56%
lcpMinusTtfb 22.95 ms +10.68% -6.32% 27.4 ms +14.42% -12.96% -16.24%
wpBeforeTemplate 23.44 ms +13.69% -3.03% 23.67 ms +15.12% -2.62% -0.97%
wpTemplate 17.88 ms +2.01% -5.2% 17.73 ms +3.21% -4.34% 0.85%
wpTotal 41.32 ms +7.7% -3.99% 41.64 ms +7.85% -2.67% -0.77%
wpMemoryUsage 7.76 MB +0% -0% 7.76 MB +0% -0% 0%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 96b0b72 try/notes-emoji-picker-autocomplete-grid % Change
timeToFirstByte 36.7 ms +6.27% -2.86% 37 ms +4.05% -3.11% -0.81%
largestContentfulPaint 68 ms +0% -5.88% 68 ms +2.94% -5.88% 0%
lcpMinusTtfb 29.05 ms +5.51% -2.24% 30.4 ms +4.11% -5.76% -4.44%
wpBeforeTemplate 20.12 ms +8.05% -0.89% 20.53 ms +6.19% -1.85% -2%
wpTemplate 13.42 ms +5.29% -4.77% 13.42 ms +3.13% -5.29% 0%
wpTotal 33.82 ms +6.24% -2.72% 33.74 ms +5.54% -2.1% 0.24%
wpMemoryUsage 6.44 MB +0% -0% 6.44 MB +0% -0% 0.01%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 96b0b72 try/notes-emoji-picker-autocomplete-grid % Change
mediaProcessingJpeg 323.08 ms +1.86% -0.18% 327.25 ms +0.79% -0.28% -1.27%
mediaProcessingAvif 4864.86 ms +0.72% -0.09% 4894.87 ms +0.22% -0.6% -0.61%
mediaProcessingJpegToAvif 3383.26 ms +0.25% -0.17% 3414.36 ms +0.28% -0.25% -0.91%

media-upload

Metric 96b0b72 try/notes-emoji-picker-autocomplete-grid % Change
jpegUploadProcessing 1471.2 ms +1.34% -1.42% 1464.32 ms +1.45% -0.62% 0.47%
pngUploadProcessing 248.53 ms +10.55% -3.3% 253.23 ms +9.49% -2.91% -1.86%
largeJpegUploadProcessing 1449.21 ms +1.03% -0.19% 1451.65 ms +0.85% -0.78% -0.17%
multipleImageUploadProcessing 1564.13 ms +7.71% -2% 1544.8 ms +1.22% -0.05% 1.25%

post-editor

Metric 96b0b72 try/notes-emoji-picker-autocomplete-grid % Change
serverResponse 280.75 ms +1.67% -11.87% 258.26 ms +6.29% -9.14% 8.71%
firstPaint 308.69 ms +8.68% -12.8% 285.43 ms +6.04% -8.74% 8.15%
domContentLoaded 551.22 ms +6.44% -2.66% 534.62 ms +3.68% -4.93% 3.11%
loaded 552.08 ms +6.42% -2.65% 535.34 ms +3.67% -4.94% 3.13%
firstContentfulPaint 315.95 ms +12.36% -3.93% 295.49 ms +10.25% -2% 6.92%
firstBlock 1511.5 ms +3.25% -4.22% 1419.98 ms +1.63% -2.5% 6.45%
type 14.11 ms +4.04% -10.21% 13.01 ms +5.07% -6.61% 8.46%
typeWithoutInspector 16.52 ms +18.28% -18.95% 13.3 ms +8.35% -8.95% 24.21%
typeWithTopToolbar 15.22 ms +9.99% -2.37% 17.67 ms +3.74% -15.39% -13.87%
typeContainer 6.25 ms +9.28% -8% 6.43 ms +6.38% -3.73% -2.8%
focus 72.24 ms +6.78% -5.33% 75.28 ms +4.2% -8.26% -4.04%
firstFocus 171.25 ms +0% -0% 193.98 ms +0% -0% -11.72%
selectAll 240.08 ms +2.16% -0.61% 246.88 ms +8.28% -2.01% -2.75%
undo 21.9 ms +3.61% -6.94% 20.19 ms +9.91% -1.78% 8.47%
listViewOpen 25.62 ms +18.46% -9.37% 25.85 ms +7.81% -8.39% -0.89%
inserterOpen 26.57 ms +3.2% -7.68% 28.4 ms +3.35% -2.64% -6.44%
inserterHover 8.38 ms +7.88% -7.04% 8.66 ms +4.27% -7.62% -3.23%
inserterSearch 6.51 ms +7.07% -2.3% 6.75 ms +3.56% -4.74% -3.56%
loadPatterns 424.75 ms +2.91% -7.69% 434.37 ms +3.95% -0.68% -2.21%
wpTotal 273.67 ms +1.48% -12.12% 251.6 ms +6.38% -9.54% 8.77%
wpMemoryUsage 14.81 MB +0% -0% 14.80 MB +0% -0% 0.03%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 96b0b72 try/notes-emoji-picker-autocomplete-grid % Change
serverResponse 322.88 ms +1.78% -5.77% 324.97 ms +4.11% -1.18% -0.64%
firstPaint 375.14 ms +1.35% -14.58% 370.06 ms +2.88% -17.81% 1.37%
domContentLoaded 674.71 ms +1.67% -1.51% 675.15 ms +0.47% -1.92% -0.07%
loaded 675.56 ms +1.67% -1.51% 676.03 ms +0.47% -1.92% -0.07%
firstContentfulPaint 377.35 ms +4.25% -0.81% 377.17 ms +2.72% -1.53% 0.05%
firstBlock 2055.04 ms +0.92% -0.92% 2087.88 ms +1.03% -1.33% -1.57%
type 15.15 ms +8.12% -8.58% 16.56 ms +3.44% -13.65% -8.51%
navigate 93.48 ms +7.46% -3.46% 91.17 ms +1.52% -3.08% 2.53%
loadPatterns 1090.39 ms +2.52% -13.04% 1131.66 ms +9.26% -6.42% -3.65%
loadPages 949.79 ms +3.65% -4.74% 927.49 ms +3.12% -1.08% 2.4%
wpTotal 314.52 ms +1.81% -5.89% 316.56 ms +4.23% -1.2% -0.64%
wpMemoryUsage 12.84 MB +0% -0% 12.84 MB +0% -0% 0.03%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

8a70d11 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Navigates the list via UP/DOWN arrow keys from action buttons in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' })
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' }) with timeout 5000ms
  - waiting for getByRole('row', { name: 'Page Two Edit Actions' }).getByRole('button', { name: 'Edit' })
    14 × locator resolved to <button type="button" tabindex="-1" class="components-button is-small" id="view-list-0-178-primary-action-edit-post">Edit</button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:243:5
keeps the default tab when a tab is added before it in /test/e2e/specs/editor/blocks/tabs.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

Expected: 2
Received: 0

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/tabs.spec.js:690:60
should keep the overlay intact when reopened before the close cleanup runs in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: clock.pauseAt: Error: Cannot fast-forward to the past
    at ClockController._innerFastForwardTo (eval at evaluate (:370:30), <anonymous>:206:13)
    at ClockController.pauseAt (eval at evaluate (:370:30), <anonymous>:132:16)
    at async <anonymous>:381:23
    at ClockController._innerFastForwardTo (eval at evaluate (:370:30), <anonymous>:206:13)
    at ClockController.pauseAt (eval at evaluate (:370:30), <anonymous>:132:16)
    at async <anonymous>:381:23
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:1403:21

8a70d11 Run

…ete-grid' into pr-84043

# Conflicts:
#	packages/editor/src/components/collab-sidebar/reactions/add-reaction-button.tsx
#	packages/editor/src/components/collab-sidebar/reactions/emoji-picker.tsx
The server-side labels seed the picker's label overrides, which take
precedence over the client's curated labels. Capitalized "Heart" broke
the exact-name lookups in the emoji reaction e2e tests and mismatched
the lowercase Emojibase names around it, which also read mid-sentence
("reacted with heart").

Claude-Session: https://claude.ai/code/session_01RmMwj4CN9cF8b1Sx58Pvik
…eaction-filters

Bring in the emoji search result count announcement from #83538.

Claude-Session: https://claude.ai/code/session_01RmMwj4CN9cF8b1Sx58Pvik
The picker test merged in from #83538 mocks `useEmojibaseConfig` with
only `baseUrl`, but this branch adds `labelOverrides` to the config, so
the mock no longer type checks.

Claude-Session: https://claude.ai/code/session_01RmMwj4CN9cF8b1Sx58Pvik
Trunk capitalized the reaction labels, and the server's named list seeds the picker's label overrides, so lowercase defaults renamed every default emoji in the picker.
@adamsilverstein
adamsilverstein removed the request for review from spacedmonkey November 11, 2026 23:17
WordPress 7.2 ships the fixed list of reactions, so the filters move to
the 7.3 compat directory. Named emoji entries now use `hex_key`, the
same shape as the `wp_note_reaction_emojis` filter in #84200, and the
key normalizer matches the one that PR adds: it rejects values that are
not code points and handles over-padded ones. Functions gain return
types and full array shapes, following the review of #84200.

Claude-Session: https://claude.ai/code/session_018vwYjSFEhWEs8GA798tZbi
Covers the `hex_key` entries the server sends and the rules that must
agree with the REST API's check.

Claude-Session: https://claude.ai/code/session_018vwYjSFEhWEs8GA798tZbi
The exclusion only matched a whole key, so a direct REST request could
append a code point that does not change how the emoji renders, such as
U+FE0E, and get an excluded emoji accepted. The picker applies the same
check so it keeps offering only what the REST API accepts.

Claude-Session: https://claude.ai/code/session_018vwYjSFEhWEs8GA798tZbi
…ete-grid' into try/notes-emoji-reaction-filters
…s-emoji-reaction-filters

# Conflicts:
#	lib/load.php
#	packages/editor/src/components/collab-sidebar/reactions/emoji-picker.tsx
#	packages/editor/src/components/collab-sidebar/reactions/frequent-emojis.ts
…ete-grid' into HEAD

# Conflicts:
#	packages/editor/CHANGELOG.md
#	packages/editor/src/components/collab-sidebar/reactions/emoji-picker.tsx

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] E2E Tests /packages/e2e-tests [Package] Editor /packages/editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant