-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix: Fixed align right issue on avatar component #67494
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
Fix: Fixed align right issue on avatar component #67494
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
ellatrix
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Quickly looking at the output of the Avatar block, it seems that the whole block is wrapped in the link, and the link is not part of the block itself. I think fixing that would be the correct approach. Would you be able to try that?
Yes, I will work on it today. |
|
Hello @ellatrix, I have also reverted the initial commit related to css changes. |
52d4c5c to
6624d15
Compare
There was a problem hiding this 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 fixes the alignment issue for the Avatar component in block-based themes when the "Link to Profile" option is enabled. The fix refactors the code structure to eliminate duplicated conditional rendering patterns.
- Introduces a reusable
AvatarLinkWrappercomponent to handle link wrapping logic - Moves the link wrapper logic inside the
ResizableAvatarcomponent instead of conditionally rendering it in multiple places - Removes duplicated conditional rendering blocks from both
CommentEditandUserEditfunctions
Comments suppressed due to low confidence (1)
| style={ borderProps.style } | ||
| /> | ||
| </ResizableBox> | ||
| <AvatarLinkWrapper isLink={ attributes.isLink }> |
Copilot
AI
Aug 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AvatarLinkWrapper is placed inside the ResizableAvatar component, which means the link wrapper will be inside the resizable container. This could interfere with the CSS float alignment fix mentioned in the PR description, as the float property on .components-resizable-box__container may not work as expected when it's nested inside a link element.
|
rebased with latest trunk. |
6624d15 to
206112c
Compare
|
It looks like we dropped the ball in terms of reviews here. Sorry about that. In my tests this is working great. Any thoughts @ellatrix |
youknowriad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes a lot of sense.
resolves #67493
What?
Added styles for Align Right in editor.scss for block themes to resolve the issue where the Avatar component alignment was not working when the "Link to Profile" option was enabled.
Why?
The Align Right feature for the Avatar component was not functioning as expected in block-based themes (e.g., Twenty Twenty-Four, Twenty Twenty-Five) when the "Link to Profile" option was selected. This PR addresses that issue by ensuring that the alignment works correctly across block themes, ensuring consistency with classic themes like Twenty Twenty-One, where it worked fine.
How?
This PR modifies the editor.scss file to explicitly add and enforce styles for the Align Right option in the block editor for Avatar components.
It adds following style snippet.
Testing Instructions
Screencast
Before
Screen.Recording.2024-12-02.at.10.54.01.PM.mov
After
Screen.Recording.2024-12-02.at.11.08.50.PM.mov