Opened 28 hours ago
Last modified 14 minutes ago
#65276 accepted defect (bug)
Media Library: Date filter is offset with empty left space when type filter is hidden
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0.1 | Priority: | normal |
| Severity: | normal | Version: | 7.0 |
| Component: | Media | Keywords: | has-patch |
| Focuses: | ui, css | Cc: |
Description
When a wp.media() frame is opened with the library restricted to a single mime type (e.g. library: { type: 'image' }), the "Filter by type" dropdown is correctly hidden, but the "Filter by date" dropdown is left visually offset with a large empty space to its left.
Steps to reproduce (no plugin required)
- Open
/wp-admin/post-new.phpon a vanilla WP 7.0 install. - In the browser DevTools console, run:
wp.media({ library: { type: 'image' } }).open(); - Switch to the "Media Library" tab.
Expected behaviour
The "Filter by date" dropdown should render flush-left where the "Filter by type" dropdown would normally sit, as it did in WP 6.x.
Actual behaviour
The "Filter by date" dropdown is rendered in the right half of the toolbar with a large empty column to its left. Affects any media modal where the type filter is hidden (for example single-mime-type frames).
Attachments (2)
Change History (10)
This ticket was mentioned in Slack in #meta by katag9k. View the logs.
28 hours ago
#2
@
28 hours ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 7.0.1
- Owner set to joedolson
- Status changed from new to accepted
@
24 hours ago
When both filtering options are visible, there also appears to be a scrollbar visible in the latest Trunk on the playground.
This ticket was mentioned in PR #11885 on WordPress/wordpress-develop by KhushalSainS.
24 hours ago
#3
- Keywords has-patch added; needs-patch removed
## What?
Fixes the alignment of the "Filter by date" dropdown in the Media Library modal when the "Filter by type" dropdown is hidden.
## Why?
When a media frame is opened with the library restricted to a single MIME type, for example:
wp.media({ library: { type: 'image' } }).open();
the "Filter by type" dropdown is hidden as expected. However, the date filter was still assigned to the second column of the toolbar grid in src/wp-includes/css/media-views.css:
label[for="media-attachment-date-filters"] { grid-area: 1 / 2 / 2 / 3; } select#media-attachment-date-filters { grid-area: 2 / 2 / 3 / 3; }
As a result, the date filter appeared offset to the right, leaving an empty space where the type filter would normally appear.
## How?
Updates the media toolbar grid positioning so the date filter uses the first column by default.
When the type filter is present, sibling selectors move the date filter back to the second column. This preserves the existing two-filter layout while fixing single-MIME-type media frames where the type filter is hidden.
## Screenshots
| Before | After |
|---|---|
| | |
## Testing Instructions
- Go to
/wp-admin/post-new.php. - Open the browser DevTools console.
- Run:
wp.media({ library: { type: 'image' } }).open();
- Switch to the Media Library tab.
- Confirm that the "Filter by date" dropdown is aligned flush-left when the type filter is hidden.
- Open a normal media frame where both filters are visible.
- Confirm that "Filter by type" and "Filter by date" still appear side by side.
Trac ticket: https://core.trac.wordpress.org/ticket/65276
## Use of AI Tools
AI assistance: Yes
Tool(s): Codex, ChatGPT
Model(s): GPT-5.5
Used for: Testing guidance, CSS fix suggestion. Final changes were reviewed and edited by me.
#4
@
24 hours ago
When both filtering options are visible, there also appears to be a scrollbar visible in the latest Trunk on the playground.
This issue is also reported here: https://core.trac.wordpress.org/ticket/23562#comment:64
@yogeshbhutkar commented on PR #11885:
23 hours ago
#5
This ticket was mentioned in PR #11891 on WordPress/wordpress-develop by @mohamedahamed.
19 hours ago
#6
## What?
Fixes the visual offset and alignment of the "Filter by date" dropdown in the Media Library modal when the "Filter by type" dropdown is hidden. It also ensures that the filters and the search input box are vertically aligned on the same row.
## Why?
When a wp.media() frame is opened with the library restricted to a single MIME type (e.g., library: { type: 'image' }), the "Filter by type" dropdown is hidden. Because column placement in the media toolbar was previously hardcoded, this caused the "Filter by date" dropdown remained offset in the second column, leaving a large empty space to its left.
## How?
CSS Grid Auto-Placement: Updated the toolbar filters in src/wp-includes/css/media-views.css to use CSS Grid auto-placement (placing labels on grid-row: 1 and selects on grid-row: 2) rather than hardcoded columns. This allows the date filter dropdown to slide flush-left naturally when the type filter is hidden.
## Screenshots
## Testing Instructions
- Go to
/wp-admin/post-new.php. - Open the browser DevTools console and run:
wp.media({ library: { type: 'image' } }).open();
- Switch to the "Media Library" tab.
- Confirm that the "Filter by date" dropdown is aligned flush-left (where the type filter would normally be) when the type filter is hidden.
- Open a normal media frame where both filters are visible (e.g. standard Media Library).
- Confirm that "Filter by type" and "Filter by date" still appear side by side.
Trac ticket: https://core.trac.wordpress.org/ticket/65276
## Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Refactoring styling rules to use auto-placement grids.
KhushalSainS commented on PR #11885:
18 hours ago
#7
Hi @yogeshbhutkar,
Thank you for pointing this out. I’ve updated the patch to address the alignment issue shown in the screenshot.
The fix is scoped specifically to media frames where the type filter is hidden and only the date filter is displayed, so the default toolbar layout with both filters remains unaffected.
This will be caused by the use of grid layout added in [62326].