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

Media & text block: Placeholder buttons has the wrong size #61812

Closed
carolinan opened this issue May 21, 2024 · 5 comments · May be fixed by #61814
Closed

Media & text block: Placeholder buttons has the wrong size #61812

carolinan opened this issue May 21, 2024 · 5 comments · May be fixed by #61814
Labels
[Block] Media & Text Affects the Media & Text Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

Description

When you place a media & text block, before selecting a media, there is a placeholder with three buttons.
With Gutenberg active, there is an unexpected change in the styling of the buttons, which are wider than in other placeholders.

Step-by-step reproduction instructions

Activate Gutenberg.
Add a media & text block.

Screenshots, screen recording, code snippet

With Gutenberg active:
Media & text block in Gutenberg has full width buttons

Expected:
Media & text block in WP version 6.5 has standard width buttons

Image block placeholder for comparison:
Image block placeholder with standard width buttons

Cover block for comparison:
cover block placeholder with standard width buttons

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

@carolinan carolinan added [Type] Bug An existing feature does not function as intended [Block] Media & Text Affects the Media & Text Block labels May 21, 2024
@philjo107
Copy link

Hey I'm new at this, which files am I supposed to make changes to?

@t-hamano
Copy link
Contributor

I believe this is related to #59275 and is the intended change. If the placeholder itself is narrow, the buttons will be stacked vertically.

So if you change the Media & Text block to wide or full width and the placeholder size increases, the buttons will line up horizontally.

image

On the other hand, if you change to the mobile viewport in other blocks, the buttons should be stacked vertically.

image

@hbhalodia
Copy link
Contributor

Hi @carolinan, I am not sure if this is related to exactly media and text, because we have used the common media placeholder for all this to render as a placeholder. I do had checked the code and found that the button size depends on the width of the container on which these buttons are being show. Here is the reference,

modifierClassNames = {
'is-large': width >= 480,
'is-medium': width >= 160 && width < 480,
'is-small': width < 160,

Based on this, since the media and text block tends to use the once side media and another side text, the placeholder container width falls in medium and small range, we can see that it is made to add it 100% of width,

.components-placeholder {
// Medium and small sizes.
&.is-medium,
&.is-small {
.components-placeholder__instructions {
display: none;
}
.components-placeholder__fieldset,
.components-placeholder__fieldset form {
flex-direction: column;
}
.components-placeholder__fieldset > *,
.components-button {
width: 100%;
justify-content: center;

In this case, let us say that, if the image/cover block is being used inside the columns, then these buttons in the placeholders would be of 100% width you can check the difference in the below screenshots,

If inside columns If outside columns
Screenshot 2024-05-21 at 4 00 02 PM Screenshot 2024-05-21 at 4 00 24 PM

So I am not sure, if the issue should be valid for this case.

Thank You.

@hbhalodia
Copy link
Contributor

I believe this is related to #59275 and is the intended change. If the placeholder itself is narrow, the buttons will be stacked vertically.

So if you change the Media & Text block to wide or full width and the placeholder size increases, the buttons will line up horizontally.

image

On the other hand, if you change to the mobile viewport in other blocks, the buttons should be stacked vertically.

image

Sorry @t-hamano, I guess I was adding the reply for this issue with the pointers you mentioned and did not check that you already replied for it. I need to just hit the comment button 😄.

@carolinan
Copy link
Contributor Author

I think it looks bad, but let's close this then.

@carolinan carolinan closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Media & Text Affects the Media & Text Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants