Skip to content

Fix reactions buttons inheriting theme background on classic themes#2996

Merged
pfefferle merged 2 commits intotrunkfrom
fix/reactions-theme-background-override
Mar 3, 2026
Merged

Fix reactions buttons inheriting theme background on classic themes#2996
pfefferle merged 2 commits intotrunkfrom
fix/reactions-theme-background-override

Conversation

@pfefferle
Copy link
Member

Fixes reaction block buttons picking up aggressive global button styles from classic themes like Twenty Twenty-One.

Proposed changes:

  • Add has-text-color and has-background classes to .reaction-label and .reaction-action-button so that TT1's :not(.has-background) / :not(.has-text-color) guards skip them — the same escape hatch WordPress themes use for blocks that manage their own colors.
  • Remove wp-element-button from .reaction-action-button to prevent block themes (TT5) from applying their generated button styles.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Activate Twenty Twenty-One (wp theme activate twentytwentyone)
  • View a post with the Reactions block that has likes/reposts
  • Verify the "2 reposts" / "3 likes" label buttons have transparent background (no dark teal fill)
  • If action buttons are enabled ("Repost", "Like"), verify they show only an outlined border — no filled background
  • Switch to Twenty Twenty-Five and verify no visual regression

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch

Type

  • Fixed - for any bug fixes

Message

Fix reactions block buttons inheriting theme background color on classic themes.

Twenty Twenty-One applies global button styles (dark background, custom
text color) to all <button> elements via selectors like
button:not(.has-background). Adding has-text-color and has-background
classes tells the theme these buttons already manage their own colors.

Also removes wp-element-button from the action button to prevent
Twenty Twenty-Five from applying its button styles.
Copilot AI review requested due to automatic review settings March 3, 2026 16:51
@pfefferle pfefferle added the Bug Something isn't working label Mar 3, 2026
@pfefferle pfefferle self-assigned this Mar 3, 2026
@pfefferle pfefferle requested a review from a team March 3, 2026 16:51
@github-actions github-actions bot added [Block] Reactions [Feature] Reactions [Focus] Editor Changes to the ActivityPub experience in the block editor labels Mar 3, 2026
@pfefferle pfefferle merged commit dea96b2 into trunk Mar 3, 2026
16 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the Reactions block’s button markup to avoid inheriting aggressive global button styles from certain classic/block themes by using WordPress’ standard has-text-color / has-background “escape hatch” classes and avoiding wp-element-button styling.

Changes:

  • Add has-text-color and has-background classes to the frontend-rendered reaction label and action buttons.
  • Remove wp-element-button from the frontend-rendered reaction action buttons to avoid block-theme generated button styles.
  • Add a changelog entry for the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/reactions/render.php Updates server-rendered button class names to avoid theme button style overrides.
build/reactions/render.php Generated build output reflecting the render markup change.
.github/changelog/fix-reactions-theme-background-override Changelog entry documenting the patch fix.

@pfefferle pfefferle deleted the fix/reactions-theme-background-override branch March 3, 2026 16:55
@pfefferle pfefferle restored the fix/reactions-theme-background-override branch March 3, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Reactions Bug Something isn't working [Feature] Reactions [Focus] Editor Changes to the ActivityPub experience in the block editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants