Skip to content

Iframe: Set the canvas lang attribute from the admin page - #85265

Open
sanketio wants to merge 2 commits into
WordPress:trunkfrom
sanketio:fix/editor-iframe-lang-attribute
Open

sanketio wants to merge 2 commits into
WordPress:trunkfrom
sanketio:fix/editor-iframe-lang-attribute

Conversation

@sanketio

Copy link
Copy Markdown
Contributor

What?

Closes #54150

Sets the lang attribute of the editor canvas iframe's <html> to match the admin page, and stops adding an empty dir for left-to-right languages.

Why?

Without lang, :lang() theme styles, hyphens: auto and browser spellcheck language detection don't work in the editor. This uses the user's language, as the classic editor does; using the site or post language when it differs is #52777.

How?

Iframe copies lang and dir from the admin page's <html> when they are set.

Testing Instructions

  1. Open Posts → Add New.
  2. Right-click the title in the canvas, choose Inspect and find the iframe's <html class="block-editor-iframe__html">.
    • It has the same lang as the admin page's <html> (for example en-US).
    • It has no empty dir attribute.
  3. Set Settings → General → Site Language to العربية (Arabic) and Users → Profile → Language to العربية, then open Posts → Add New again and inspect the iframe's <html>.
    • It has lang="ar" and dir="rtl", matching the admin page's <html>.

Use of AI Tools

Authored with Claude Code under direction and review; all results above were run locally.

@sanketio
sanketio requested a review from ellatrix as a code owner October 21, 2026 08:06
@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @martin-neumann-gurus.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: martin-neumann-gurus.

Co-authored-by: sanketio <sanketparmar@git.wordpress.org>
Co-authored-by: inc2734 <inc2734@git.wordpress.org>
Co-authored-by: krokodok <krokodok@git.wordpress.org>
Co-authored-by: sabernhardt <sabernhardt@git.wordpress.org>

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

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.

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] Block editor /packages/block-editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iframe: document needs language attributes

1 participant