Directory

Avatar block alignment is not working well in some themes · Issue #56706 · WordPress/gutenberg · GitHub
Skip to content
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

Avatar block alignment is not working well in some themes #56706

Open
pitamdey opened this issue Dec 1, 2023 · 3 comments
Open

Avatar block alignment is not working well in some themes #56706

pitamdey opened this issue Dec 1, 2023 · 3 comments
Labels
[Block] Avatar Affects the Avatar Block [Type] Bug An existing feature does not function as intended

Comments

@pitamdey
Copy link

pitamdey commented Dec 1, 2023

Description

Avatar block alignment is not working in some themes like Twenty Twenty-one, Twenty nineteen, Twenty Seventeen and Twenty Sixteen but it is working fine with Twenty Twenty-two & Twenty Twenty-Three.
The Main issue is that centre align is not reflected in editor side
Here is a Video of the issue along with how it works :
https://drive.google.com/file/d/1YIng2VrJY9Zt1dgqD-Pg7_Lps4LaDoIW/view?usp=sharing

As This is an editor problem, so it should be fixed in the Gutenberg plugin first and then we can check in core

Step-by-step reproduction instructions

  1. Active Twenty Twenty-one, Twenty nineteen, Twenty Seventeen theme on by one
  2. Add avatar block
  3. Change the alignment and now you can see that the alignment is not working as expected

Screenshots, screen recording, code snippet

https://drive.google.com/file/d/1YIng2VrJY9Zt1dgqD-Pg7_Lps4LaDoIW/view

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@pitamdey pitamdey added the [Type] Bug An existing feature does not function as intended label Dec 1, 2023
@jordesign jordesign added [Block] Avatar Affects the Avatar Block Needs Testing Needs further testing to be confirmed. labels Dec 1, 2023
Copy link

github-actions bot commented Jan 1, 2024

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jan 1, 2024
@tellthemachines
Copy link
Contributor

I can reproduce this issue. It's caused by the align wrapper that classic themes use in the editor to wrap blocks with alignment. This means that the element that's receiving the text-align: center style used to center align the block is a div with a block type display, instead of an img with an inline type. text-align: center doesn't work with block display.

If the align wrappers need to be maintained for back compat, then it might be worth considering using flex styles for the center align instead.

@tellthemachines tellthemachines removed Needs Testing Needs further testing to be confirmed. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. labels Apr 5, 2024
@sabernhardt
Copy link
Contributor

It seems to need both text-align: center on the block and margin: 0 auto for the inner element.

Maybe avatar/editor.scss could have something like this:

.wp-block[data-align="center"] > .wp-block-avatar,
.wp-block-avatar.aligncenter  {
	text-align: center;

	& .components-resizable-box__container {
		margin: 0 auto;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Avatar Affects the Avatar Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants