Skip to content

Emoji: Print the emoji detection script in the admin footer.#11905

Open
sirreal wants to merge 1 commit into
WordPress:trunkfrom
sirreal:trac-65260/emoji-script-footer
Open

Emoji: Print the emoji detection script in the admin footer.#11905
sirreal wants to merge 1 commit into
WordPress:trunkfrom
sirreal:trac-65260/emoji-script-footer

Conversation

@sirreal
Copy link
Copy Markdown
Member

@sirreal sirreal commented May 20, 2026

Move the emoji detection script to the footer in WP Admin. This ensures it should be printed after an importmap and avoid an issue where Firefox does not process importmaps once a module has been encountered.

This implements a minimal fix suggested by @westonruter.

Since [60899], the emoji detection script is output as a <script type="module">. In the admin it was hooked to admin_print_scripts, so the module script tag was emitted inside <head> ahead of the script-module import map (which is printed at admin_print_footer_scripts priority 9).

Move the hook to admin_print_footer_scripts, mirroring the frontend behavior put in place by [60902] for #64076. Update the matching remove_action() in edit-form-blocks.php so the post editor continues to suppress the emoji detection script.

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


Testing

This can be tested by following the reproduction steps in the ticket. Firefox should be used.

In the site editor on trunk, module specifiers cannot be resolved because the importmap is not processed. For example await import('@wordpress/route') will throw an error like:

TypeError: The specifier “@wordpress/route” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

On this branch, the import will work correctly.


Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Opus-4.7
Used for: Complete implementation, verification, and testing based on ticket.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@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 jonsurrell.

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

Since [60899], the emoji detection script is output as a `<script type="module">`. In the admin it was hooked to `admin_print_scripts`, so the module script tag was emitted inside `<head>` ahead of the script-module import map (which is printed at `admin_print_footer_scripts` priority 9). Per the HTML spec, an import map encountered after a module script becomes inert, so importing modules such as `@wordpress/abilities` or `@wordpress/latex-to-mathml` in the Site Editor failed in spec-strict browsers (e.g. Firefox).

Move the hook to `admin_print_footer_scripts`, mirroring the frontend behavior put in place by [60902] for #64076. Update the matching `remove_action()` in `edit-form-blocks.php` so the post editor continues to suppress the emoji detection script.

Props westonruter, wildworks.
See #65260.
@sirreal sirreal force-pushed the trac-65260/emoji-script-footer branch from 56b5d24 to 345c2fa Compare May 20, 2026 20:46
@github-actions
Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

}

add_action( 'admin_print_scripts', 'print_emoji_detection_script' );
add_action( 'admin_print_footer_scripts', 'print_emoji_detection_script' );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The only concern I have about this is back-compat for sites which gave sought to disable emoji. Thus change would cause emoji to show up again in the admin for them, no?

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