Skip to content

Commit

Permalink
Media: Hide sidebar in Create Gallery when no actions available.
Browse files Browse the repository at this point in the history
Check whether the media frame menu has action items. If not, hide the sidebar. Prevents showing a sidebar that looks interactive but contains no controls that are interactive. When in Create Gallery mode, the only action available is 'Create Gallery', and it is always active.

Props ukdrahul, ababir, ruchirj, nhrrob, joedolson, shailu25, mukesh27, sudipatel007, dhrumilk.
Fixes #60666.

git-svn-id: https://develop.svn.wordpress.org/trunk@59139 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
joedolson committed Sep 30, 2024
1 parent 891a774 commit 26aef32
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/js/media/controllers/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,15 @@ var State = Backbone.Model.extend(/** @lends wp.media.controller.State.prototype
_menu: function() {
var menu = this.frame.menu,
mode = this.get('menu'),
actionMenuItems,
actionMenuLength,
view;
view,
actionMenuItems = this.frame.menu.get('views'),
actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0;

if ( this.frame.menu ) {
actionMenuItems = this.frame.menu.get('views'),
actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0,
// Show action menu only if it is active and has more than one default element.
this.frame.$el.toggleClass( 'hide-menu', ! mode || actionMenuLength < 2 );
}
if ( ! mode ) {
if ( ! mode || actionMenuLength < 2 ) {
return;
}

Expand Down

0 comments on commit 26aef32

Please sign in to comment.