Skip to content

Site Editor: Decode HTML entities in Identity fields - #81269

Merged
ntsekouras merged 4 commits into
WordPress:trunkfrom
drewmt:fix/dataform-decode-html-entities
Aug 7, 2026
Merged

Site Editor: Decode HTML entities in Identity fields#81269
ntsekouras merged 4 commits into
WordPress:trunkfrom
drewmt:fix/dataform-decode-html-entities

Conversation

@drewmt

@drewmt drewmt commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #81252.

Decode HTML entities where Site Editor Identity values are displayed:

  • Site Title and Site Tagline field values.
  • Media attachment titles shown by the Site Logo and Site Icon controls.

Why?

Identity REST values can contain strings such as Jordan's Test or
Logo & Mark. Plain React text controls otherwise display those entities
literally instead of showing the readable title.

How?

The Identity text fields decode their values in their local getValue
functions. MediaEdit decodes the attachment's REST title.rendered value at
the two text display boundaries: the compact filename and expanded replacement
label.

This keeps the change local to the affected screen/components. Source records,
IDs, URLs, alt text, sorting, filtering, validation, and unrelated DataForm
fields remain unchanged.

Testing Instructions

Automated checks run locally:

  • Targeted JavaScript/TypeScript lint passed.
  • Package JSON lint, lockfile validation, formatting, pre-commit checks, and
    git diff --check passed.

No new test dependency or test files are introduced; the change stays limited
to the affected display-time decodeEntities calls.

Manual verification:

  1. Open the Site Editor and go to Design → Identity.
  2. Save a Site Title and Site Tagline containing &, ', or angle brackets.
  3. Reload Identity and confirm both text fields show readable characters rather
    than HTML entities.
  4. Select a Site Logo and Site Icon whose attachment title contains &.
  5. Confirm the selected media filename shows & rather than &.
  6. Save and reload, then confirm all four values remain readable and editable.

Testing Instructions for Keyboard

  1. Tab through the Site Title and Site Tagline inputs and edit the values.
  2. Use the keyboard to choose or replace the Site Logo and Site Icon.
  3. Confirm the media replacement control has a readable accessible name and
    the form remains fully operable.

Screenshots or screencast

Not included; this restores the readable text represented by existing stored
values and does not introduce a new visual state.

Use of AI Tools

OpenAI Codex was used to help trace the value flow and run validation. I
reviewed the resulting diff and take responsibility for the contribution.

@github-actions github-actions Bot added the [Package] DataViews /packages/dataviews label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

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.

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: drewmt <linewebdigital@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>

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

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @drewmt! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Aug 6, 2026

@t-hamano t-hamano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR!

Perhaps the key is where to decode. Personally, I think it might be best to fix it directly in the field where the problem occurs, as a minimal fix. Perhaps like this.

const fields = [
	{
		id: 'title',
		type: 'text',
		label: __( 'Site Title' ),
		description: __(
			"Displays in your site's layout via the Site Title block."
		),
		getValue: ( { item } ) => decodeEntities( item.title ?? '' ),
	},
	// ...
];

Furthermore, please note that this issue occurs across all fields of the identity screen, meaning the problem with the media field also needs to be resolved.

Image

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Aug 6, 2026
@github-project-automation github-project-automation Bot moved this to 🔎 Needs Review in WordPress 7.1 Editor Tasks Aug 6, 2026
@t-hamano t-hamano moved this from 🔎 Needs Review to 🏗️ In Progress in WordPress 7.1 Editor Tasks Aug 6, 2026
@t-hamano t-hamano moved this from 🏗️ In Progress to 🔎 Needs Review in WordPress 7.1 Editor Tasks Aug 6, 2026
@drewmt drewmt changed the title DataForms: Decode HTML entities in text inputs Site Editor: Decode HTML entities in Identity fields Aug 6, 2026
@github-actions github-actions Bot added [Package] Edit Site /packages/edit-site [Package] Fields /packages/fields and removed [Package] DataViews /packages/dataviews labels Aug 6, 2026
@drewmt

drewmt commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the guidance! I've moved decoding into the Identity title and tagline getters, and covered attachment titles in MediaEdit for both the visible filename and replacement label. I also added regressions for all four fields; 36 relevant tests pass locally.

Comment thread packages/edit-site/package.json Outdated

@t-hamano t-hamano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Before After
Image Image

@oandregal @ntsekouras, do you think we can backport this PR to 7.1?

@ntsekouras ntsekouras left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks!

@ntsekouras

Copy link
Copy Markdown
Contributor

@t-hamano sounds good to include for 7.1.

@drewmt can you rebase please to resolve the changelog conflicts?

@t-hamano t-hamano added the Backport to WP 7.1 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Aug 7, 2026
@drewmt
drewmt force-pushed the fix/dataform-decode-html-entities branch from dec1f3b to ca6214c Compare August 7, 2026 07:42
@drewmt

drewmt commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, Nik! I've rebased onto the latest trunk and resolved the changelog conflicts. The PR is mergeable again, and the fresh checks are running.

@ntsekouras
ntsekouras enabled auto-merge (squash) August 7, 2026 07:44
@ntsekouras
ntsekouras merged commit 8323351 into WordPress:trunk Aug 7, 2026
58 checks passed
@github-project-automation github-project-automation Bot moved this from 🔎 Needs Review to ✅ Done in WordPress 7.1 Editor Tasks Aug 7, 2026
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

There was a conflict while trying to cherry-pick the commit to the wp/7.1 branch. Please resolve the conflict manually and create a PR to the wp/7.1 branch.

PRs to wp/7.1 are similar to PRs to trunk, but you should base your PR on the wp/7.1 branch instead of trunk.

# Checkout the wp/7.1 branch instead of trunk.
git checkout wp/7.1

# Create a new branch for your PR.
git checkout -b my-branch

# Cherry-pick the commit.
git cherry-pick 8323351f39157e0e83162d78b3551a46f2b4ffef

# Check which files have conflicts.
git status

# Resolve the conflict...
# Add the resolved files to the staging area.
git status
git add .
git cherry-pick --continue

# Push the branch to the repository
git push origin my-branch

# Create a PR and set the base to the wp/7.1 branch.
# See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request.

@ntsekouras

Copy link
Copy Markdown
Contributor

@drewmt can you handle the manual backport to wp/7.1. Let me know if you can't and I can do it.

@drewmt

drewmt commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, Nik! I've opened #81320 with the manual backport to wp/7.1. Only the two changelog conflicts needed resolving; the source changes match the merged PR.

ntsekouras added a commit that referenced this pull request Aug 7, 2026
Co-authored-by: drewmt <linewebdigital@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>
@ntsekouras ntsekouras removed the Backport to WP 7.1 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Aug 7, 2026
@t-hamano t-hamano added the Backported to WP Core Pull request that has been successfully merged into WP Core label Aug 7, 2026
amitraj2203 pushed a commit that referenced this pull request Aug 10, 2026
Co-authored-by: drewmt <linewebdigital@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Aug 12, 2026
This updates the pinned commit hash of the Gutenberg repository from `ea285b45692aed6c4f95353671393402f97f0aa7` to `b9743a015526ac8fd79298fd4e96cf002cee333b`.

A full list of changes included in this commit can be found on GitHub: 
WordPress/gutenberg@ea285b4...b9743a0

- Style states: fix state deselection when selecting the already selected block (WordPress/gutenberg#81277)
- Global styles: render element styles set only inside a breakpoint (WordPress/gutenberg#81265)
- Style states: Fix phantom pseudo element style output (WordPress/gutenberg#81291)
- Docs: remove breakpoint-only element style example from global styles guide (WordPress/gutenberg#81308)
- theme.json schema: responsive states belong to blocks (WordPress/gutenberg#81253)
- theme.json schema: allow responsive states on block style variations (WordPress/gutenberg#81309)
- Render viewport state element styles in the editor (WordPress/gutenberg#81307) (WordPress/gutenberg#81311)
- Site Editor: Decode HTML entities in Identity fields (WordPress/gutenberg#81269) (WordPress/gutenberg#81320)
- Editor: Keep the canvas height stable while resizing the canvas (WordPress/gutenberg#81374)
- Playlist: Normalize Waveform Player configuration handling (WordPress/gutenberg#81375)
- Playlist: Improve audio conversion and track selection (WordPress/gutenberg#80926) (WordPress/gutenberg#81385)
- fix: order site identity changes predictably (WordPress/gutenberg#81283)
- Cover: Avoid passing null as the featured image size (WordPress/gutenberg#81444)
- components/Menu: Restore Modal focus return when menu items close (WordPress/gutenberg#81446)
- Notes: Fix text wrapping for long usernames in collaboration sidebar (WordPress/gutenberg#81406)
- Site Editor: Use inverted ThemeProvider seed for portaled UI (WordPress/gutenberg#81296)

Props wildworks.
See #65529.

git-svn-id: https://develop.svn.wordpress.org/branches/7.1@63209 602fd350-edb4-49c9-b593-d223f7449a82
shail-mehta pushed a commit that referenced this pull request Aug 12, 2026
Co-authored-by: drewmt <linewebdigital@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jordesign <jordesign@git.wordpress.org>
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Aug 12, 2026
This updates the pinned commit hash of the Gutenberg repository from `ea285b45692aed6c4f95353671393402f97f0aa7` to `b9743a015526ac8fd79298fd4e96cf002cee333b`.

A full list of changes included in this commit can be found on GitHub: 
WordPress/gutenberg@ea285b4...b9743a0

- Style states: fix state deselection when selecting the already selected block (WordPress/gutenberg#81277)
- Global styles: render element styles set only inside a breakpoint (WordPress/gutenberg#81265)
- Style states: Fix phantom pseudo element style output (WordPress/gutenberg#81291)
- Docs: remove breakpoint-only element style example from global styles guide (WordPress/gutenberg#81308)
- theme.json schema: responsive states belong to blocks (WordPress/gutenberg#81253)
- theme.json schema: allow responsive states on block style variations (WordPress/gutenberg#81309)
- Render viewport state element styles in the editor (WordPress/gutenberg#81307) (WordPress/gutenberg#81311)
- Site Editor: Decode HTML entities in Identity fields (WordPress/gutenberg#81269) (WordPress/gutenberg#81320)
- Editor: Keep the canvas height stable while resizing the canvas (WordPress/gutenberg#81374)
- Playlist: Normalize Waveform Player configuration handling (WordPress/gutenberg#81375)
- Playlist: Improve audio conversion and track selection (WordPress/gutenberg#80926) (WordPress/gutenberg#81385)
- fix: order site identity changes predictably (WordPress/gutenberg#81283)
- Cover: Avoid passing null as the featured image size (WordPress/gutenberg#81444)
- components/Menu: Restore Modal focus return when menu items close (WordPress/gutenberg#81446)
- Notes: Fix text wrapping for long usernames in collaboration sidebar (WordPress/gutenberg#81406)
- Site Editor: Use inverted ThemeProvider seed for portaled UI (WordPress/gutenberg#81296)

Props wildworks.
See #65529.
Built from https://develop.svn.wordpress.org/branches/7.1@63209


git-svn-id: http://core.svn.wordpress.org/branches/7.1@62402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Edit Site /packages/edit-site [Package] Fields /packages/fields [Type] Bug An existing feature does not function as intended

Projects

Development

Successfully merging this pull request may close these issues.

Site Editor Identity: apostrophes in Site Title get HTML-encoded (&#039;) and shown as literal entities in the input

3 participants

Sponsor
SponsoredKunjungi sekarang
Promo