Skip to content

Highlight: inherit block text color for background-only marks - #82298

Open
dilipom13 wants to merge 2 commits into
WordPress:trunkfrom
dilipom13:fix/36532-highlight-inherit-block-color
Open

Highlight: inherit block text color for background-only marks#82298
dilipom13 wants to merge 2 commits into
WordPress:trunkfrom
dilipom13:fix/36532-highlight-inherit-block-color

Conversation

@dilipom13

Copy link
Copy Markdown
Contributor

What

Fixes #36532

When only a background highlight is applied, the <mark> element now uses color: inherit so block-level text colors are preserved instead of being overridden by the browser default mark color.

How

  • Add getHighlightTextColorStyle() helper in packages/format-library/src/text-color/utils.js
  • Apply color:inherit in the highlight format when a background color is set without an explicit text color
  • Unit tests for the helper logic

Test plan

  • Add a paragraph with a block-level text color in the sidebar
  • Select text and apply only a background highlight (no text color)
  • Confirm the text keeps the block-level color
  • Apply both text and background colors — both should still work
  • Clear highlight and confirm formatting is removed as expected

Apply color:inherit when only a background highlight is set so mark styling does not override block-level text colors.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dilipom13
dilipom13 requested a review from ellatrix as a code owner September 1, 2026 16:31
@github-actions

github-actions Bot commented Sep 1, 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: dilipom13 <dilip2615@git.wordpress.org>
Co-authored-by: fullofcaffeine <fullofcaffeine@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 added the [Package] Format library /packages/format-library label Sep 1, 2026
@shail-mehta shail-mehta added the [Type] Bug An existing feature does not function as intended label Sep 1, 2026
@dilipom13

Copy link
Copy Markdown
Contributor Author

Hello
Could you please add the [Type] Bug label? I don't have permission to add labels on this repo.

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] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[format/highlights] Block-level color specificity issues when a text block has a block-level color set

2 participants