Make WordPress Core

Changeset 57688


Ignore:
Timestamp:
02/21/2024 07:44:17 PM (2 months ago)
Author:
joedolson
Message:

Media: Prevent Media Library sidebar from showing with no actions.

Fix an issue where the actions sidebar in the media library could appear when there are no relevant actions available.

Props sruthi89, nithi22, ivanzhuck, dhruvishah2203, joemcgill, ukdrahul, joedolson, shailu25.
Fixes #58973.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/controllers/state.js

    r47122 r57688  
    166166        var menu = this.frame.menu,
    167167            mode = this.get('menu'),
     168            actionMenuItems = this.frame.menu.get('views'),
     169            actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0,
    168170            view;
    169171
    170         this.frame.$el.toggleClass( 'hide-menu', ! mode );
     172        // Show action menu only if it is active and has more than one default element.
     173        this.frame.$el.toggleClass( 'hide-menu', ! mode || actionMenuLength < 2 );
    171174        if ( ! mode ) {
    172175            return;
Note: See TracChangeset for help on using the changeset viewer.