Skip to content

Add classname instead of inline background color when using Text Highlight - #84609

Open
Vedant-Gandhi wants to merge 6 commits into
WordPress:trunkfrom
Vedant-Gandhi:fix/text-highlight-inline-color
Open

Vedant-Gandhi wants to merge 6 commits into
WordPress:trunkfrom
Vedant-Gandhi:fix/text-highlight-inline-color

Conversation

@Vedant-Gandhi

Copy link
Copy Markdown
Contributor

What?

  • Add a classname if using a color from palette when using Text Highlight Background color.

Why?

#49332

How?

Add logic to detect if selected background color is used from palette and add it as has-* syntax instead of inlining the color else fallback to color inlining.

Testing Instructions

  • Add a new para on the Post/Page.
  • Select the text and go to More > Highlight > Background and set the background color from palette.
  • Save the Post/Page and view it on the frontend.
  • Go to devtools and observe that the color for background must have a class name in format has-*-background-color.
  • Repeat the above by using a color apart from the palette.

Screenshots or screencast tp

Screenshot 2026-10-13 at 14 15 51

Use of AI Tools

I have used Claude Sonnet 5.5 or reviewed the issue as well as using it as an assistant to write the code. It has also been used to write comments in the code as well as reivewing the test cases and updating them as needed. I have thoroughly reviewed the code and ensured it does not introduce any side effects on other components apart from the fix being introduced.

@github-actions github-actions Bot added the [Package] Format library /packages/format-library label Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 Props

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: Vedant-Gandhi <vedantgandhi28@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.

@shimotmk shimotmk added the [Type] Enhancement A suggestion for improvement. label Oct 19, 2026

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] Format library /packages/format-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants