Skip to content

Reactions: Fix avatar display bugs #1835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 23, 2025
Merged

Reactions: Fix avatar display bugs #1835

merged 6 commits into from
Jun 23, 2025

Conversation

obenland
Copy link
Member

Fixes margins between avatars and details button, when there are hidden avatars:

Before After
Screenshot 2025-06-18 at 2 56 47 PM Screenshot 2025-06-18 at 2 56 34 PM

Fixes hidden avatars when there are fewer Likes than reposts:

Before After
Screenshot 2025-06-18 at 2 28 21 PM Screenshot 2025-06-18 at 3 01 37 PM

Proposed changes:

  • Adjust styles to maintain consistent margin between avatars and detail button.
  • Add comment type context to decide how many avatars to show.

Testing instructions:

  • On a test post with a different amount of Likes and Reposts, make sure all avatars are displayed as expected.
  • Make sure the distance between avatars and button is consistent.

Changelog entry

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

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

The amount of avatars shown in the Reactions block no longer depends on the amount of likes, but is comment type agnostic.

@obenland obenland requested a review from pfefferle June 18, 2025 20:06
@obenland obenland self-assigned this Jun 18, 2025
@Copilot Copilot AI review requested due to automatic review settings June 18, 2025 20:06
@github-actions github-actions bot added [Block] Reactions [Feature] Reactions [Focus] Editor Changes to the ActivityPub experience in the block editor labels Jun 18, 2025
Copy link

@Copilot 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

This PR resolves avatar display issues by refining element selection and adjusting spacing between reaction elements. Key changes include filtering reaction groups by reaction type in the JS view, updating CSS gap and margin rules to ensure consistent spacing, and adding a data-reaction-type attribute in the PHP render for consistency.

Reviewed Changes

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

File Description
src/reactions/view.js Filters reaction-group elements based on reactionType attribute.
src/reactions/style.scss Adjusts spacing (gap and margin rules) to ensure proper avatar layout.
src/reactions/render.php Introduces data-reaction-type attribute to match JS element filtering.
build/* Builds updated assets to reflect source code changes.
Comments suppressed due to low confidence (1)

src/reactions/style.scss:47

  • Verify that the use of the ':has' pseudo-class is fully supported by all target browsers, as its performance and compatibility could affect the proper removal of margin on avatars without a hidden sibling.
				&:not([hidden]):not(:has(~ li:not([hidden]))) {

@@ -87,7 +87,7 @@ const { callbacks, state } = store( 'activitypub/reactions', {
}

getElement()
.ref.querySelectorAll( '.reaction-group' )
.ref.querySelectorAll( `.reaction-group[data-reaction-type="${ reactionType }"]` )
Copy link
Member

Choose a reason for hiding this comment

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

do these quotation marks work properly 😳

Copy link
Member Author

Choose a reason for hiding this comment

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

In my testing they did. What's the concern?

Copy link
Member

@pfefferle pfefferle Jun 23, 2025

Choose a reason for hiding this comment

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

that they won't work 😂

(simply haven't seen them in use for JS, CSS or HTML)

@obenland obenland merged commit a05148a into trunk Jun 23, 2025
11 checks passed
@obenland obenland deleted the update/reactions-avatars branch June 23, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Reactions [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.

3 participants