Make WordPress Core

Opened 5 months ago

Closed 3 months ago

#63559 closed defect (bug) (fixed)

Buttons on Edit Media screen have smaller height than other buttons

Reported by: hbhalodia's profile hbhalodia Owned by: joedolson's profile joedolson
Milestone: 6.9 Priority: normal
Severity: normal Version: 5.3.1
Component: Media Keywords: has-patch has-screenshots commit
Focuses: ui, css, administration Cc:

Description

  • On Edit media screen, we have some buttons which are used to update the media, may be crop, rotate etc, for which the buttons sizes are not consistent are less than other buttons across the admin site.
  • Button such as, Crop, Scale, rotation have 28px height, while the button across site have 30px, which looks odd.
  • When we try to add the crop, we see 2 buttons in line, Apply Crop and Clear Crop, which actually identifies this issue, as both buttons are not aligned and Clear crop button is actually a 2px small, which should not be.
  • CSS which adds this is actually added here, https://github.com/WordPress/wordpress-develop/blob/eeb8fbf81bfc3fe83efd9bc327ac5015211b76b7/src/wp-admin/css/media.css#L974-L980, On changing to 30px, actually resolves the issue.

Attachments (2)

Screenshot 2025-06-12 at 11.35.59 AM.png (744.5 KB) - added by hbhalodia 5 months ago.
Button with 28px height
Screenshot 2025-06-12 at 11.35.32 AM.png (754.6 KB) - added by hbhalodia 5 months ago.
Button with 30px height

Download all attachments as: .zip

Change History (20)

@hbhalodia
5 months ago

Button with 28px height

@hbhalodia
5 months ago

Button with 30px height

This ticket was mentioned in PR #8963 on WordPress/wordpress-develop by @hbhalodia.


5 months ago
#1

  • Keywords has-patch added

#2 @sabernhardt
5 months ago

  • Summary changed from Edit Media: Buttons on edit media screen have samll height which are not consitent with other buttons to Buttons on Edit Media screen have smaller height than other buttons
  • Version changed from trunk to 5.3.1

[46326] resized the image editing buttons to show text with the icons, but then [46866] apparently missed standardizing their height.

@hbhalodia commented on PR #8963:


5 months ago
#3

Hi @sabernhardt, I have updated the PR to use the 28px line height.

#4 @joedolson
5 months ago

  • Milestone changed from Awaiting Review to 6.9
  • Owner set to joedolson
  • Status changed from new to accepted

#5 @sandeepdahiya
5 months ago

  • Keywords has-test-info has-screenshots added

Bug Reproduction and Test Report

✅ This report validates that the indicated patch addresses the issue.
Patch tested: Patch-8963.diff

Environment

  • OS: Windows 11 Home
  • Web Server: Nginx 1.27.5
  • PHP: 8.2.28
  • WordPress: 6.9-alpha-60093-src
  • Browser: Mozilla Firefox 139.0.1 (Latest)
  • Theme: Twenty Fourteen
  • Active Plugins:
    • Code Snippets 3.6.8
    • WordPress Beta Tester 3.6.3

Actual Results

  • 🐞 Bug reproduction - On the Media → Edit Image screen, several buttons had inconsistent heights. The "Apply Crop" button was 30px, while other action buttons — "Clear Crop", "Crop", "Scale", and "Rotate" — were only 28px high, resulting in visual misalignment.

Clear crop button 28px
Crop, Scale, Image Rotation - Button 28px
Apply crop button 30px

  • ✅ Issue resolved with patch – It standardizes all related buttons to 30px height, resolving the inconsistency.

Apply Crop, Clear Crop button - 30px
Crop, Scale, Image Rotation - Button 30px

Additional Notes

  • The above patch works smoothly on smaller screen sizes as well.

#6 @mikinc860
5 months ago

The solution appears to be working, but it's also affecting other buttons on the same screen. Please ensure that everything remains properly aligned.

Last edited 5 months ago by mikinc860 (previous) (diff)

#7 @hbhalodia
5 months ago

Hi @mikinc860, Can you please share how it's affecting other buttons, or what other buttons are being affected? It would help in updating the solution.

Thank You,

@mukesh27 commented on PR #8963:


4 months ago
#8

The changes looks good to me.

https://github.com/user-attachments/assets/ef59633e-91b0-4799-b829-8026982a60c4

#9 @mukesh27
4 months ago

  • Keywords commit added

Mark ready for commit.

#10 @joedolson
4 months ago

  • Keywords changes-requested added; commit removed

Added some additional comments on the PR; but to summarize, I don't think this selector is needed anymore, and we can just get rid of all the rules applying to it.

@hbhalodia commented on PR #8963:


4 months ago
#11

I question whether any of the styles in this selector are actually needed. All of them except width: auto are just duplicating the styles already applied by .wp-core-ui .button; and I don't see that is making any difference.

I think it would be a better change to eliminate this whole selector; I suspect that the only reason it's here is because these _used_ to be icon buttons, and needed different styles to support that.

Yes, I checked that by removing it and seems that it uses .wp-core-ui .button styles, and we can remove that selector. I am updating the PR with the changes.

Thank You,

#12 @hbhalodia
4 months ago

Hi @joedolson, Have updated the PR to eliminate the selector and used default .wp-core-ui button styles for the same.

Commit - https://github.com/WordPress/wordpress-develop/pull/8963/commits/f5b19d1f91adf28e417574c0bf55703bf818bfa6

Thank You,

@sabernhardt commented on PR #8963:


4 months ago
#13

Removing the ruleset makes a big difference on mobile. All the buttons in .imgedit-panel-tools plus 'Clear Crop' would have a larger size and larger text.

Apply Crop would still need the .button class to be consistent with 'Clear Crop' and other buttons.
<button class="button button-primary"

English, before and after, at 750 pixels wide (Edit Media, list view)

https://github.com/user-attachments/assets/76dd2e43-5fb0-4c77-a928-03306811b58e https://github.com/user-attachments/assets/e3ff5f98-7c81-4051-b406-02da54c501ae

French, before and after, at 750 pixels wide (Edit Media, list view)

https://github.com/user-attachments/assets/972f85af-134b-492c-b74a-d57eeff96550 https://github.com/user-attachments/assets/a2a287e5-1da7-4a4a-aa77-15b5cdf9cf2a

#14 @joedolson
4 months ago

In my opinion, that's a good change on mobile; but would appreciate second opinions on that.

And yes, I agree that this doesn't work unless the Apply Crop button gets .button

@hbhalodia commented on PR #8963:


4 months ago
#15

Apply Crop would still need the .button class to be consistent with 'Clear Crop' and other buttons.
<button class="button button-primary"

I agree on this, button class should be added on Apply crop button.

For the other changes, I think we should take other opinions as well, but IMO, on mobile button size is same as other buttons on across the admin area. I have checked posts, comments, plugins have same size as we are seeing after change in media.

#16 @joedolson
3 months ago

  • Keywords commit added; has-test-info changes-requested removed

I gave some thought to exploring the original intent in having these buttons not match the sizing on mobile that other buttons do. Looking at the code history, I think it was just overlooked when the controls were changed from div elements to button elements in 2015; the previous styles were simply copied over to the new button elements without applying global styling for buttons.

As such, in my opinion the larger buttons on mobile is more in keeping with the intentions of the mobile viewport for WordPress and this should be committed with this change.

#18 @joedolson
3 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 60640:

Media: Fix button sizing on Edit Media screen.

On the Edit Media screen, buttons were not all of consistent size. This was caused by custom sizing applied to CSS in the Edit Media panel that was not consistent with other button sizes.

Remove custom sizing and adds class so all Edit Media buttons will match styling of other admin buttons in desktop and mobile viewports.

Props hbhalodia, sabernhardt, sandeepdahiya, mikinc860, mukesh27, joedolson.
Fixes #63559.

Note: See TracTickets for help on using tickets.