Make WordPress Core

Opened 2 months ago

Closed 5 weeks ago

#64763 closed defect (bug) (fixed)

Admin reskin: Remove line-height from input elements

Reported by: wildworks's profile wildworks Owned by: audrasjb's profile audrasjb
Milestone: 7.0 Priority: normal
Severity: normal Version: trunk
Component: Administration Keywords: admin-reskin good-first-bug has-patch dev-reviewed
Focuses: Cc:

Description

The line-height of the input element has a value of 2.71428571 applied to it, making it equal to a height of 40px. This value also seems to affect the height of the background highlight when text is selected. At least, this behavior can be confirmed on Windows OS and Chrome browsers.

I don't know why this line-height value exists, but it's strange to have a highlight background that extends to the full height of the form.

Attachments (2)

highlighted-background.png (24.7 KB) - added by wildworks 2 months ago.
The background when text in an input element is selected. Comparison of the current style and my proposed style.
64763-improved.patch (891 bytes) - added by sachinrajcp123 5 weeks ago.
Patch for #64763 - Removes unnecessary line-height from standard input elements - Adds minor adjustments to improve alignment in some inputs This builds upon previous patches. Patch ready for review.

Download all attachments as: .zip

Change History (37)

@wildworks
2 months ago

The background when text in an input element is selected. Comparison of the current style and my proposed style.

#1 @audrasjb
2 months ago

  • Keywords good-first-bug added
  • Version set to trunk

Adding good-first-bug keyword as this issue would be a nice bug to fix for new contributors who never submitted any Core patch yet.

#2 @wildworks
2 months ago

@fabiankaegy @joedolson Is there any reason why a line-height value equal to min-height is being applied to form elements? Would simply removing the line-height cause any problems?

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


2 months ago
#3

  • Keywords has-patch added

Remove line-height property from URL and week input styles.

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

## Use of AI Tools

@hmrisad commented on PR #11099:


2 months ago
#4

Could you please add the ticket URL to the PR description?

Thanks! I’ve added the ticket URL to the PR description.

#5 @manhar
2 months ago

Tested the patch on trunk.

Removing the line-height keeps the 40px height via min-height and improves text alignment/selection. No visual regressions found in admin screen.

Before Patch:
https://postimg.cc/FYXV0Hb0

After Patch:
https://postimg.cc/yJQRp19N

#6 @audrasjb
2 months ago

  • Owner set to audrasjb
  • Status changed from new to reviewing

@audrasjb commented on PR #11099:


2 months ago
#7

Thanks for the PR!

It applies nicely to standard inputs:
https://github.com/user-attachments/assets/f03c608b-a20e-4ddb-a938-4baae9dd6abf

However it doesn't apply to input fields using "compact" styles:
https://github.com/user-attachments/assets/dc21517d-dc40-41f6-8d0f-d37f378bf5c0

#8 @ozgursar
2 months ago

Patch Testing Report

Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11099

Environment

  • WordPress: 7.0-beta2-61752-src
  • PHP: 8.2.29
  • Server: nginx/1.29.4
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 145.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Steps taken

  1. Check an input field in Settings > General
  2. ✅ Patch is solving the problem

Expected result

  • Line height is removed from input elements

Screenshots/Screencast with results

Before
https://i.imgur.com/inm2yTo.png

After
https://i.imgur.com/WhqWVXm.png

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


8 weeks ago
#9

## Description
Removes the line-height: 2.71428571 declaration from standard admin input elements. Height remains 40px via min-height; only the line-height is removed.

## Changes

  • File: src/wp-admin/css/forms.css
  • Removed one line-height line from the rule that targets input[type="datetime"] through input[type="week"] (and related types).

## Testing

  • Checked inputs on Settings → General and other admin forms.
  • Confirmed input height unchanged (40px) and selection highlight no longer fills the full field.

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

Fixes #64763

@huzaifaalmesbah commented on PR #11156:


8 weeks ago
#10

Thanks for the PR.
I noticed there is already an older PR (#11099) for the same issue and it has been reviewed by a committer. Maybe it would be better to continue contributing there instead of opening a new PR.

@manishxdp commented on PR #11156:


8 weeks ago
#11

@huzaifaalmesbah Thanks for review. okay noted

#12 @noruzzaman
8 weeks ago

Test Report

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

Environment

  • WordPress: 7.0-beta2-61809
  • PHP: 8.3.30
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 145.0.0.0
  • OS: macOS
  • Theme: Twenty Fourteen 4.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Actual Results

  1. ✅ Issue resolved with patch.
Before After
https://i.ibb.co.com/V0GPv2J6/Before.png https://i.ibb.co.com/P0Rv9Fg/After.png

#14 @wildworks
8 weeks ago

  • Keywords needs-refresh added; has-patch removed

Thankyou everyone for working on this ticket.

However it doesn't apply to input fields using "compact" styles:

As mentioned here, there's probably more than one thing that needs to be fixed. Let's try to investigate as much as possible where this problem is occurring.

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


7 weeks ago
#15

  • Keywords has-patch added; needs-refresh removed

This change removes the redundant line-height property from text-based admin input elements in src/wp-admin/css/forms.css.

The height of these elements is already sufficiently handled by the min-height property (40px for standard inputs and 32px for compact inputs), making an explicit line-height unnecessary and potentially problematic for certain font-rendering scenarios.

With regards to the previous patches in this ticket, this PR also removes the line height in the reported search bar as seen below:

Before:
https://github.com/user-attachments/assets/f86265f6-a65a-4bb2-b3af-ae9ac8c4d732

After:
https://github.com/user-attachments/assets/e27463a8-37ac-4aba-82c5-974bfaabceed

Trac ticket: [](https://core.trac.wordpress.org/ticket/64763)

## Use of AI Tools

This ticket was mentioned in Slack in #core-test by nikunj8866. View the logs.


6 weeks ago

#17 @r1k0
6 weeks ago

  • Keywords changes-requested added

Patch Testing Report

Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11246

Environment

  • WordPress: 7.0-beta5-61991-src
  • PHP: 8.3.30
  • Server: nginx/1.29.5
  • Database: mysqli (Server: 8.4.8 / Client: mysqlnd 8.3.30)
  • Browser: Chrome 146.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Steps taken

  1. Head over to Pages > All pages.
  2. Enter text into the search input field, then highlight the text.
  3. Observe the height of the highlight.
  4. ❌ Patch is not entirely solving the problem.
  1. Bonus: Check the height of the highlight background for the input fields, which I have listed in the additional notes section. Also, feel free to check other input fields around the admin dashboard.

Expected result

  • The highlight background should have a shorter height meant to fit the highlighted text.

Additional Notes

  • While the patch fixes the highlight height of the search input field in the Pages page and multiple other places. It still doesn't fix the highlight height for several other input fields.

As mentioned here, there's probably more than one thing that needs to be fixed. Let's try to investigate as much as possible where this problem is occurring.

  • As noted above, multiple input fields need to be fixed. Thus, updating keywords to let @arkaprabhachowdhury make the necessary changes.
  • When you remove the line-height for the Custom time & date format input field, the input field changes its height slightly. This makes the border top & bottom too close to the text. I suggest changing the min-height value to min-height: 26px;.
  • Find screenshots of some of the other input fields that need to be fixed in the Support Content section.
  • These input fields need to be fixed as well:
Page Input-Fields
Add Plugin Search Plugins
Add Theme Search Themes
Comment(Quick Edit) Name
Email
URL
All Pages(Quick Edit) Title
Slug
Order
Password
All Posts(Quick Edit) Title
Slug
Password
Tags & Categories(Quick Edit) Name
Slug
Media Library Search Media
Dashboard (Events widget) City search
Settings > General Time/Date Format (custom)

Screenshots/Screencast with results

Page search before:
https://i.ibb.co/VpYb75qG/search-pages-before.png

Page search after:
https://i.ibb.co/HT5Q9LwP/search-pages-after.png

Support Content

  • Here are supporting screenshots that show input fields that also need to be fixed.

Media search input field:
https://i.ibb.co/Y7sn95x9/media-search.png

Page quick edit title input field:
https://i.ibb.co/yFwzy5Fb/page-title.png

@audrasjb commented on PR #11246:


6 weeks ago
#18

The issue still persists in the Comments screen, on quick edit fields.

https://github.com/user-attachments/assets/d99ed911-c339-4ba2-ada3-bece709a3890

@wildworks commented on PR #11099:


6 weeks ago
#19

Let's close this PR in favor of #11246.

@Risad212 Thanks for your efforts!

This ticket was mentioned in Slack in #core by juanmaguitar. View the logs.


5 weeks ago

@juanmaguitar commented on PR #11246:


5 weeks ago
#21

Hi @ArkaPrabhaChowdhury! Thanks for working on this issue.
As per this comment it seems the PR is still not solving the issue.
Do you think you'll be able to address this before WP 7.0 final release (in a few weeks)?

@arkaprabhachowdhury commented on PR #11246:


5 weeks ago
#22

Hey @juanmaguitar

I am trying my best to look into all the inputs fields and checking their line height which is taking some time.

Will try my best to address the issues and raise the fixes before the WP 7.0 final release.

Thanks!

#23 @manhar
5 weeks ago

line-height should be removed from standard form controls, but .wp-core-ui .tablenav inputs should be excluded from this change. These controls likely need a separate approach to maintain proper alignment without relying on line-height.

@sachinrajcp123
5 weeks ago

Patch for #64763 - Removes unnecessary line-height from standard input elements - Adds minor adjustments to improve alignment in some inputs This builds upon previous patches. Patch ready for review.

#24 @audrasjb
5 weeks ago

@sachinrajcp123 thanks for the patch, however it doesn't apply against trunk. Could you please send a new one that is not build upon other PRs but against trunk? And a Github PR would be better, too. Thank you :)

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


5 weeks ago
#25

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

## Use of AI Tools

<!--
You are free to use artificial intelligence (AI) tooling to contribute, but you must disclose what tooling you are using and to what extent a pull request has been authored by AI. It is your responsibility to review and take responsibility for what AI generates. See the WordPress AI Guidelines: <https://make.wordpress.org/ai/handbook/ai-guidelines/>.

Example disclosure:

AI assistance: Yes
Tool(s): Claude

@wildworks commented on PR #11246:


5 weeks ago
#26

@ArkaPrabhaChowdhury Thanks for the PR! Let me close this PR in favor of #11383.

#27 @wildworks
5 weeks ago

I submitted a new https://github.com/WordPress/wordpress-develop/pull/11383 to address all input elements.

@audrasjb commented on PR #11383:


5 weeks ago
#28

Thanks for the PR! I spotted two more occurrences.

General settings:
https://github.com/user-attachments/assets/c5bd0501-8728-4a6a-9acc-c780bcd8482c

Colorpicker:
https://github.com/user-attachments/assets/36d5cd3b-8066-4eb5-a3a5-3ab0633302ef

Otherwise the rest looks good to me!

@wildworks commented on PR #11383:


5 weeks ago
#29

Nice catch!

Colorpicker:

Addressed in ea7f3d0c14b7b82b37df158e8c1186f4438bbab0

General settings:

Addressed in 935dd5ee9dc5719f1da048a158790829f6a2ad8b

Simply removing the line-height changes the input field's height from 26px to 24px. This value is considered small in our design system, but the field feels too tiny:

https://github.com/user-attachments/assets/ad599570-fb2d-455d-87c6-7d216e94dcd6

Therefore, I removed the line-height and increased the height from 26px to 32px. What do you think?

https://github.com/user-attachments/assets/96cf71a5-48e3-4371-95d4-b2138794f16a

@audrasjb commented on PR #11383:


5 weeks ago
#30

Looking great to me, thanks!

#31 @wildworks
5 weeks ago

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

In 62171:

Admin reskin: Remove line-height from input fields.

line-height values that were previously used to match the height of input fields affect the height of the background shown when text inside those fields is selected. Removing these line-height declarations allows the text selection highlight to render more naturally.

Additionally, update the height of the custom Date/Time format input fields on the General Settings screen to 32px to align with the new design system.

Props arkaprabhachowdhury, audrasjb, hmrisad, huzaifaalmesbah, manhar, manishxdp, noruzzaman, ozgursar, r1k0, sachinrajcp123, wildworks.

Fixes #64763.

#32 @wildworks
5 weeks ago

  • Keywords dev-feedback added; changes-requested removed

Reopening #64763 to request backporting [62171] to 7.0 branch

#33 @audrasjb
5 weeks ago

  • Keywords dev-reviewed added; dev-feedback removed

Here's a second committer sign off for backport to branch 7.0.
Thanks!

#34 @audrasjb
5 weeks ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport to 7.0.

#35 @audrasjb
5 weeks ago

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

In 62172:

Admin reskin: Remove line-height from input fields.

line-height values that were previously used to match the height of input fields affect the height of the background shown when text inside those fields is selected. Removing these line-height declarations allows the text selection highlight to render more naturally.

Additionally, update the height of the custom Date/Time format input fields on the General Settings screen to 32px to align with the new design system.

Reviewed by wildworks, audrasjb.
Merges [62171] to the 7.0 branch.

Props arkaprabhachowdhury, audrasjb, hmrisad, huzaifaalmesbah, manhar, manishxdp, noruzzaman, ozgursar, r1k0, sachinrajcp123, wildworks.
Fixes #64763.

Note: See TracTickets for help on using tickets.