Skip to content

fix: decode html entities in post excerpts - #436

Merged
AllTerrainDeveloper merged 2 commits into
WordPress:trunkfrom
Pranjal1423:fix/posts-excerpt-entities
Jul 28, 2026
Merged

fix: decode html entities in post excerpts#436
AllTerrainDeveloper merged 2 commits into
WordPress:trunkfrom
Pranjal1423:fix/posts-excerpt-entities

Conversation

@Pranjal1423

@Pranjal1423 Pranjal1423 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Closes #430

Description

This PR fixes a visual bug where HTML entities in post excerpts (such as smart quotes “ / ” or apostrophes ’) were rendered raw inside the sub-row expanded view of the native Posts window.

Root Causes & Fixes

Missing Entity Decoding in Excerpt Render:

  • Issue: The REST API returns post excerpts with HTML-encoded entities in the excerpt.rendered payload. While the Posts window stripped HTML tags before rendering, it did not decode the remaining HTML entities, causing them to render literally (e.g. “ showing on screen).
  • Fix: Added a shared decodeHTML utility inside src/utils.ts and updated the buildSubRow function in src/posts-window/index.ts to decode the text before setting it as .textContent. Additionally, refactored decodeTitle in the same file to reuse the shared decodeHTML utility.

Verification

  • Build: npm run build completed successfully.
  • Typecheck: `npm run typec
  • Unit Tests: npm run test:js completed successfully with all 1601/1601 Vitest tests passing.

Screenshots

Before Fix
Screenshot 2026-07-28 at 1 42 49 PM

After Fix
Screenshot 2026-07-28 at 2 02 49 PM

@AllTerrainDeveloper AllTerrainDeveloper left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you again! Glad to see you back!

@AllTerrainDeveloper
AllTerrainDeveloper merged commit 9fc3dc5 into WordPress:trunk Jul 28, 2026
6 checks passed
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.

Raw HTML entities (like “) showing in expanded post excerpts

2 participants