Make WordPress Core

Opened 5 months ago

Closed 5 months ago

#65428 closed defect (bug) (fixed)

Scale button not aligned to dimensions on edit image screen.

Reported by: muryam Owned by: joedolson
Priority: normal Milestone: 7.0.1
Component: Media Version: 7.0
Severity: normal Keywords: has-patch dev-feedback
Cc: Focuses: ui, css

Description

Attachments (3)

WP 7 button alignment.png​ (96.2 KB ) - added by muryam 5 months ago.
WP 7 Scale button alignment
Scale in 6.9 version.png​ (70.5 KB ) - added by muryam 5 months ago.
Scale button in 6.9 Version
button-height-conmarison-in-mobile.png​ (90.1 KB ) - added by wildworks 5 months ago.
Comparison of button heights in WordPress 6.9 and WordPress 7.0

Download all attachments as: .zip

Change History (15)

@muryam
5 months ago

WP 7 Scale button alignment

@muryam
5 months ago

Scale button in 6.9 Version

#1 @joedolson
5 months ago

  • Milestone Awaiting Review → 7.0.1
  • Owner set to joedolson
  • Status new → accepted

This ticket was mentioned in ​PR #12112 on ​WordPress/wordpress-develop by ​@khokansardar.


5 months ago
#2

  • Keywords has-patch added

## Summary

  • On the Edit Image screen (media modal), the Scale button rendered 8px shorter than the adjacent width/height inputs and sat top-aligned, leaving a visible gap below it. See the "WP 7" vs "6.9" screenshots on the ticket.
  • Root cause: the 7.0 design-system reskin ([61645] / #64547) raised form inputs to a 40px min-height, while .media-modal-content .button applies a compact 32px min-height to buttons in the modal. The Scale control row was missed, so its inputs are 40px but its button stayed 32px.
  • Fix: give the Scale button a 40px min-height within .imgedit-scale-controls and center its label with flexbox, so all three controls match in height and align. The inputs are kept at the accessible 40px target size rather than shrunk to 32px.

## Why this approach


  • Reverting the originating commit isn't viable — it's the full reskin touching many files; this is a targeted fix for the one missed control group.
  • Bumping the button to 40px (vs. shrinking inputs to 32px) keeps the larger, accessible target size, consistent with the rest of the reskin and matching the pre-7.0 (6.9) appearance where the controls were equal height.
  • Flexbox centering avoids hard-coded line-height magic numbers and follows the same "convert to flexbox" direction as the reskin.

Trac ticket: https://core.trac.wordpress.org/ticket/65428

## Use of AI Tools

N/A

#3 @noruzzaman
5 months ago

Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/12112

Environment

  • WordPress: 7.1-alpha-20260606.133254
  • Subdirectory: No
  • PHP: 7.4.33
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 148.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

✅ Issue resolved with this patch.

Before After
https://i.ibb.co.com/pBnNcRzB/Before.png https://i.ibb.co.com/rf2tbmzb/after.png

#4 @wildworks
5 months ago

It would be easy to change only the height of the problematic button to 40px, but that seems like a temporary fix. For starters, why is the button height in this modal 32px when we've set 40px as the default in our new design system? Furthermore, buttons like Crop and Scale should be 40px in the mobile layout, but they aren't. It seems like there's some kind of inconsistency at play. Shouldn't we remove the following CSS that forces a height of 32px?

​https://github.com/WordPress/wordpress-develop/blob/8a9d768c98ee80c010949a6f529b33807185cf9c/src/wp-admin/css/media.css#L794-L798

​https://github.com/WordPress/wordpress-develop/blob/8a9d768c98ee80c010949a6f529b33807185cf9c/src/wp-includes/css/media-views.css#L275-L280

If we do, all buttons will be displayed with a height of 40px, which should consequently fix the alignment issues.

If we truly need a button with a size of 32px, I recommend using the .button-compact CSS class instead of applying min-height. This is because the button-compact CSS class changes the button's height to 40px in the mobile layout.

@wildworks
5 months ago

Comparison of button heights in WordPress 6.9 and WordPress 7.0

This ticket was mentioned in ​PR #12125 on ​WordPress/wordpress-develop by ​@wildworks.


5 months ago
#5

Alternatives to #12112

If the button size is 32px by default, many CSS overrides are required to match the height of other form elements such as input and select, which are 40px.

This PR changes the default button size from 32px to 40px in the media modal and attachment detail modal. While this PR is a bit aggressive, it should resolve all button size inconsistencies.

Trac ticket: https://core.trac.wordpress.org/ticket/65428

## Screenshots

### Attachment details modal

Before After
https://github.com/user-attachments/assets/0d2bc98e-b197-43a4-a535-7cf095d537ec https://github.com/user-attachments/assets/1c4fd30d-2140-4d70-b027-736f7723c4f6
https://github.com/user-attachments/assets/31e7d736-d3a8-450f-9aef-c99791c6378c https://github.com/user-attachments/assets/3e04c935-33a7-4d7f-9934-ce48c580038f

### Image details

Before After
https://github.com/user-attachments/assets/0cd86afa-687a-44c5-8a0a-3846f03df9ad https://github.com/user-attachments/assets/886750df-f57f-4601-b2b8-5072a09d59b6

## Use of AI Tools

N/A

#6 @tusharaddweb
5 months ago

Confirmed. On the Edit Image screen → Scale tab, the height input and Scale button are not vertically aligned in the New Dimensions row.

Refer below images :

Before Patch :
​https://postimg.cc/MnhGY3L7

After Patch :
​https://postimg.cc/F7wmtdVj

Patch looks good.

​@huzaifaalmesbah commented on ​PR #12125:


5 months ago
#7

Looks Good.

Before After
https://github.com/user-attachments/assets/590e00d6-5617-4bb6-ad1b-d423f8694e99 https://github.com/user-attachments/assets/dc8e8877-1fd1-494a-b31d-6de8098181eb

​@masteradhoc commented on ​PR #12125:


5 months ago
#8

Hey @t-hamano
Thank you very much for this PR. can confirm on edit-media and edit-image the Buttons now are 40px high.

EDIT-MEDIA
https://github.com/user-attachments/assets/549237ca-9326-4eaa-b3f1-48160a92cdc4

EDIT-IMAGE
https://github.com/user-attachments/assets/14a0a3de-1d64-4b20-821d-14621cf1a5c4

I think we should go with this approach instead of #12112.

​@wildworks commented on ​PR #12112:


5 months ago
#9

Hi @itzmekhokan, thanks for working on this.

Now that #12125 has been approved, I would like to close this pull request.

#10 @wildworks
5 months ago

  • Resolution → fixed
  • Status accepted → closed

In 62587:

Media: Use the default 40px button height in the media modal.

Buttons in the media modal and attachment detail modal defaulted to a 32px height via CSS overrides, while form elements such as input and select use the default 40px. Remove these overrides so buttons fall back to the default 40px height, resolving the size inconsistencies.

Props cbravobernal, huzaifaalmesbah, khokansardar, masteradhoc, muryam, noruzzaman, tusharaddweb, wildworks.
Fixes #65428.

#11 @wildworks
5 months ago

  • Keywords dev-feedback added
  • Resolution fixed
  • Status closed → reopened

Reopening #65428 to request backporting [62587] to 7.0 branch

#12 @cbravobernal
5 months ago

  • Resolution → fixed
  • Status reopened → closed

In 62596:

Media: Use the default 40px button height in the media modal.

Buttons in the media modal and attachment detail modal defaulted to a 32px height via CSS overrides, while form elements such as input and select use the default 40px. Remove these overrides so buttons fall back to the default 40px height, resolving the size inconsistencies.

Reviewed by cbravobernal.
Merges [62587] to the 7.0 branch.

Props cbravobernal, huzaifaalmesbah, khokansardar, masteradhoc, muryam, noruzzaman, tusharaddweb, wildworks.
Fixes #65428.

Note: See TracTickets for help on using tickets.