Skip to content

Twenty Nineteen: Replace whitespace character for heading decoration. - #12121

Open
KarunyaChavan wants to merge 4 commits into
WordPress:trunkfrom
KarunyaChavan:fix/65433-2019-theme-empty-heading-hyphen
Open

KarunyaChavan wants to merge 4 commits into
WordPress:trunkfrom
KarunyaChavan:fix/65433-2019-theme-empty-heading-hyphen

Conversation

@KarunyaChavan

Copy link
Copy Markdown

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

When a user inserts an empty heading block in the editor and applies an "Underline" or "Strikethrough" text decoration, the browser attempts to underline the pseudo-element's whitespace character. This interaction causes a stray, visible hyphen-like artifact to render inside the editor above the empty block as

Heading decorated with underline
Heading decorated with strikethrough

What this Changes

  • This PR updates the post-section-dash mixin in sass/mixins/_mixins-master.scss to use an empty string (content: "";) instead of content: "\020".
  • By removing the whitespace character, the pseudo-element no longer contains an actual text node.
  • Since the element has explicit display: block, width, and height properties, the decorative dash continues to render identically on the frontend and backend.
  • However, because there is no text content, the browser can no longer underline a whitespace character, completely resolving the visual bug in the editor without requiring any editor-specific CSS overrides.
Decorated Heading blocks after fix

Use of AI Tools

AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): GPT-4o
Used for: To verify optimality and efficiency of the patch.


…nt stray hyphen.

- Replaces `content: "\020"` with `content: ""` in the `post-section-dash` mixin.
- Prevents a visible hyphen from rendering in the editor when an empty heading block has the underline text decoration active.
@github-actions

github-actions Bot commented Jun 8, 2026

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.

@KarunyaChavan
KarunyaChavan marked this pull request as ready for review June 8, 2026 10:58
@github-actions

github-actions Bot commented Jun 8, 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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props karunyachavan84, sabernhardt, karmatosed.

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.

@KarunyaChavan KarunyaChavan changed the title Twenty Nineteen: Empty Heading block displays stray hyphen in editor when underline decoration is enabled. Twenty Nineteen: Replace whitespace character for heading decoration. Jun 8, 2026
@karmatosed

Copy link
Copy Markdown
Member

There are merge conflicts with this, if we can get a new patch worked on, happy to do that.

@sabernhardt sabernhardt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I applied the patch cleanly via Tortoise SVN, but it would be good to refresh the PR again after r64610.

Test Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/12121.diff

Environment

  • WordPress: 7.2-beta1-64606-src at revision 64673
  • PHP: 8.4.0
  • Server: Apache/2.4.62 (Win64) PHP/8.4.0 mod_fcgid/2.3.10-dev
  • Database: mysqli (Server: 9.1.0 / Client: mysqlnd 8.4.0)
  • Browsers:
    • Firefox 158.0, using private window for the front-end screenshots and default window to show the editor
    • Edge 155.0.4283.62, with Explain & Send Screenshots extension
    • Google Chrome 155.0.8059.80, combining 3 screenshots
  • OS: Windows 11
  • Theme: Twenty Nineteen 3.4, as it is in trunk

Steps taken

  • Create a new post.
  • Add a title, and enable comments.
  • Add H1 and H2 headings, or even all heading levels.
  • If using Heading blocks, copy all blocks and set additional headings to Align text center and Align text right.
  • Publish the post and add an approved comment.
  • Copy the headings from the post and paste them in the widget area. Update the widgets.
  • Visit the post author's User profile, add Biographical Info for the author of the post, and save changes.
  • View the post on the front end. It should look identical before and after applying the patch.
  • Create another post with a title.
  • Add two heading blocks, both H1 and H2 levels.
  • In the Typography settings for each block, show the Decoration options and select Strikethrough.
  • While the block is still empty, check whether a line—in the text color—appears in front of the editor's gray "Heading" placeholder text. (It appears before applying the patch but not with the patch.)

Expected results with patch

  • ✅ The line pseudo-element continues to display above H1 and H2 headings except for the site title:
    • headings within post and widget content (h1:not(.site-title):before, h2:before)
    • post titles (.entry .entry-title:before)
    • "Published by" heading for the author biography (.author-bio .author-title:before)
    • "Join the Conversation" heading for comments (.comments-area .comments-title-wrap .comments-title:before)
  • ✅ The line also continues to align with text when using center and right alignment options.
  • ✅ The extra line does not appear in the editor when the heading is still empty and the decoration option is selected.

Screenshots with results

This Firefox screenshot shows H1 and H2 headings in post, author bio, comments, and widget areas after applying the patch.

H1 and H2 headings in Firefox with the patch

I also made screenshots of H1 and H2 in Chrome and Edge, plus a screenshot with all headings in Firefox.

Within the editor, the extra Strikethrough line no longer appears if the decoration is set before the heading has any text.

Before patch With patch
empty heading shows an extra strikethrough line before the patch editor does not have the extra line with the patch

Support Content

blocks used for each post: one set with all heading levels, one set with the empty headings

wporg-sync pushed a commit that referenced this pull request Nov 9, 2026
When a user inserts an empty heading block in the editor and applies an "Underline" or "Strikethrough" text decoration, the browser attempts to underline the pseudo-element's whitespace character. This interaction causes a stray, visible hyphen-like artifact to render inside the editor above the empty block.

This changeset updates the CSS content property to use the empty string `content: "";` instead of `content: \020`. By removing the whitespace character, the pseudo-element no longer contains an actual text node.

Developed in #12121.

Props karunyachavan84, sabernhardt, karmatosed, tusharaddweb, 369work.
Fixes #65433.



git-svn-id: https://develop.svn.wordpress.org/trunk@65362 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 65362
GitHub commit: 781803b

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Nov 9, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 9, 2026
When a user inserts an empty heading block in the editor and applies an "Underline" or "Strikethrough" text decoration, the browser attempts to underline the pseudo-element's whitespace character. This interaction causes a stray, visible hyphen-like artifact to render inside the editor above the empty block.

This changeset updates the CSS content property to use the empty string `content: "";` instead of `content: \020`. By removing the whitespace character, the pseudo-element no longer contains an actual text node.

Developed in WordPress/wordpress-develop#12121.

Props karunyachavan84, sabernhardt, karmatosed, tusharaddweb, 369work.
Fixes #65433.


Built from https://develop.svn.wordpress.org/trunk@65362


git-svn-id: http://core.svn.wordpress.org/trunk@64501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@sabernhardt sabernhardt reopened this Nov 11, 2026
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.

3 participants