Opened 3 days ago
Last modified 21 hours ago
#65296 new defect (bug)
Library section under Media, search bar shifts position after searching in the WordPress admin area.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 7.0.1 | Priority: | normal |
| Severity: | major | Version: | 7.0 |
| Component: | Administration | Keywords: | has-screenshots has-patch |
| Focuses: | ui, administration | Cc: |
Description
## Issue
After installing WordPress, the search bar in the Library under Media tab section shifts position after performing a search in the admin area.
## Reproduction Steps
- Log into the WordPress admin dashboard.
- Go to Media → Library.
- Search for any media item using the search bar.
- Observed Result.
## Observed Result
After searching, the search bar jumps/shifts unexpectedly in the Library section UI.
## Expected Result
The search bar should remain stable and properly aligned after performing a search.
Attachments (2)
Change History (6)
@
3 days ago
The search bar position also shifts when using Grid View after selecting a media item and applying a date filter.
#1
@
3 days ago
The search bar position also shifts when using Grid View after selecting a media item and applying a date filter.
Already uploaded another attachment.
This ticket was mentioned in PR #11937 on WordPress/wordpress-develop by @mohamedahamed.
2 days ago
#3
- Keywords has-patch added
## Summary
Fixes an issue where the search bar in the Media Library (Admin grid view) shifts/jumps horizontally (moves to the left and then snaps back) when typing/removing text in the search input or applying a date filter.
### Root Cause
During search/filtering updates, the Backbone.js view shows/hides the loading spinner and an overlay element (.media-bg-overlay) to block interaction and display the loading state.
However, .media-bg-overlay was only styled within the @media screen and (max-width: 782px) media query in media-views.css. On screens wider than 782px (desktop), the element had no style definitions. Consequently, when jQuery called .show(), the overlay was displayed as a default block element (display: block) in the normal document flow. Because it sits inside the .media-toolbar container, its insertion disrupted the floated and flex layout of .media-toolbar-primary (containing the search input) and .media-toolbar-secondary, causing the layout elements to shift.
### Solution
- Defined
.media-bg-overlayglobally (outside of media queries) with absolute positioning. This takes the overlay out of the document flow on all screen sizes, preventing any layout reflow/shift.
## Changes
### src/wp-includes/css/media-views.css
- Moved
.media-bg-overlaylayout definition to a global rule so it is always absolutely positioned and overlaying the toolbar correctly on both desktop and mobile views.
## Testing
| Test Case | Expected / Result | Status |
|---|---|---|
| Typing search queries in Media Library Grid View | Search bar remains stable, no horizontal shift | ✅ Passed |
| Selecting media item and applying a Date filter | Grid layout remains stable, no horizontal shift | ✅ Passed |
Trac ticket: https://core.trac.wordpress.org/ticket/65296
## Use of AI Tools
AI assistance: No
#4
@
21 hours ago
- Milestone changed from Awaiting Review to 7.0.1
I believe this issue is a regression caused by the following style added by r61645.
.upload-php .wp-filter { display: flex; }
When performing a filter search, display: block is applied to the overlay, which seems to cause unintended issues with flex layouts.
<div class="media-toolbar wp-filter"> <!-- `display: flex` is applied -->
<div class="media-toolbar-secondary">
</div>
<div class="media-toolbar-primary search-form">
</div>
<div class="media-bg-overlay" style="display: none;"></div> <!-- `display:block` is dynamically applied here during filter search -->
</div>
Library section search bar shifts position after searching in WordPress admin area.