Make WordPress Core

Opened 6 weeks ago

Last modified 2 days ago

#63553 new defect (bug)

Administration: Color Schemes are not properly applied on individual attachment within media views

Reported by: yogeshbhutkar's profile yogeshbhutkar Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch has-screenshots needs-testing
Focuses: ui, css, administration Cc:

Description

In the Media Library dialog, where users select from listed attachments, individual attachments do not fully reflect the user's selected color scheme. This is often due to CSS specificity issues, that is, styles in media-views.css have higher specificity and override the selected color scheme styles. Ideally, the specificity of styles within media-views.css should match that of the color scheme styles to allow proper theming overrides.

Ref:
https://github.com/WordPress/wordpress-develop/blob/20e4872868780fd9246d8a7ec5ae3072b69483ea/src/wp-includes/css/media-views.css#L1128

https://github.com/WordPress/wordpress-develop/blob/20e4872868780fd9246d8a7ec5ae3072b69483ea/src/wp-admin/css/colors/_admin.scss#L572

In the snippets above, notice that the .wp-core-ui is omitted from _admin.scss, which leads to lower CSS specificity, and the color scheme styles do not get properly applied. Also, notice the extra theme-related styles (example: for the :focus pseudo-selector) which are also omitted altogether from _admin.scss.

This bug is quite noticeable for users using administration color schemes other than the default within the Gutenberg Editor.

To reproduce, perform the following steps:

  1. Set a different administration color scheme (preferably Midnight).
  2. Create a new post and insert a core/file block.
  3. Click on Media Library and click on a particular attachment.
  4. Notice that the attachment selection styles do not comply with the selected administration color scheme.

Attachments (4)

admin-color-theme.png (150.7 KB) - added by yogeshbhutkar 6 weeks ago.
Notice the color scheme is applied everywhere except the individual attachment selection.
Screenshot 2025-06-12 at 10.38.13 AM.png (34.7 KB) - added by hbhalodia 5 weeks ago.
Screenshot 1
Screenshot 2025-06-12 at 10.38.25 AM.png (64.0 KB) - added by hbhalodia 5 weeks ago.
Screenshot 2
Screenshot 2025-06-12 at 10.43.54 AM.png (373.9 KB) - added by hbhalodia 5 weeks ago.
It should be using the orange color border to respect user preference

Download all attachments as: .zip

Change History (11)

@yogeshbhutkar
6 weeks ago

Notice the color scheme is applied everywhere except the individual attachment selection.

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


6 weeks ago
#1

  • Keywords has-patch added

### Description

This PR ensures that the selected admin color scheme is correctly applied to individual attachments in the Media Library. Previously, due to CSS specificity issues, custom color schemes were overridden, leading to inconsistent styling.

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

### Screenshots

BeforeAfter
https://github.com/user-attachments/assets/e70c9b65-e59f-44de-a11c-9f1b1bc0a76fhttps://github.com/user-attachments/assets/07d29910-0e26-4c29-bbf1-90bf279dd427
https://github.com/user-attachments/assets/40cf22af-8976-4c1f-8137-fce542b1c658https://github.com/user-attachments/assets/678a5fe4-b406-4416-b751-855dc83ce50d

#2 @yogeshbhutkar
6 weeks ago

  • Keywords has-screenshots added

#3 follow-up: @hbhalodia
5 weeks ago

Hi @yogeshbhutkar, In addition to this, I would also like to update the select dropdown and input text (or any other input text) to be use the same border color on focus that is being set as user preference.

This is because, when we change the user settings to use another color, the gutenberg components respects that color for example, on focus input border color is same as user preference (see the screenshot), but on the media select popup, if you focuses on search media or filter it via date, when focused, it uses the default color being set here - https://github.com/WordPress/wordpress-develop/blob/eeb8fbf81bfc3fe83efd9bc327ac5015211b76b7/src/wp-includes/css/media-views.css#L128-L139, instead it should use the color set as a user preference.

We need to change the specificity as you correctly updated for the media selection checkbox and border for that, we need to accomodate for the same.

Let me know if that should be the case and should we update that?

Edit: I do check the posts/page/media screen, it adds the correct border color on focus (that is user preference color), hence we should definately update the media popup box to use the user preference color, instead of default one.

Thank You,

Last edited 5 weeks ago by hbhalodia (previous) (diff)

@hbhalodia
5 weeks ago

It should be using the orange color border to respect user preference

#4 in reply to: ↑ 3 @yogeshbhutkar
5 weeks ago

Replying to hbhalodia:

In addition to this, I would also like to update the select dropdown and input text (or any other input text) to be use the same border color on focus that is being set as user preference.

I agree with this change and the reasoning behind it. I've updated my PR accordingly to reflect this adjustment.

#5 @rollybueno
4 weeks ago

  • Keywords needs-testing added

#6 @yogeshbhutkar
2 days ago

  • Component changed from Administration to Media

This ticket was mentioned in Slack in #core-media by yogesh_bhutkar. View the logs.


2 days ago

Note: See TracTickets for help on using tickets.