Make WordPress Core

Opened 5 months ago

Last modified 4 weeks ago

#60666 accepted defect (bug)

Unwanted section appears as a sidebar in 'Create gallery' section

Reported by: ukdrahul's profile ukdrahul Owned by: joedolson's profile joedolson
Milestone: 6.7 Priority: normal
Severity: normal Version: 5.0
Component: Media Keywords: has-patch
Focuses: javascript Cc:

Description

Unwanted section with 'Actions' and 'Create gallery' texts appear in the sidebar of Media Library and nothing happens on selection or click of the texts.

To find the issue, please go through the below steps.

1.From the 'File' block add the block 'Gallery', then select Media Library.
2.Unwanted sidebar section with the specified texts appears.

Attachments (3)

Unwanted section appears for gallery block.png (1.4 MB) - added by ukdrahul 5 months ago.
Unwanted sidebar appears for gallery block
60666.diff (908 bytes) - added by joedolson 5 weeks ago.
Converts comment into patch
60666.png (548.4 KB) - added by shailu25 5 weeks ago.
Added Attchment

Download all attachments as: .zip

Change History (21)

@ukdrahul
5 months ago

Unwanted sidebar appears for gallery block

#1 @ababir
5 months ago

I have seen the same issue for just the image block. Here is ticket #58973. It seems like this ticket was solved on 6.5. But it still exists for the 'Image Gallery' block.

#2 @joedolson
5 months ago

  • Focuses javascript added
  • Milestone changed from Awaiting Review to 6.6
  • Owner set to joedolson
  • Status changed from new to accepted
  • Version set to 5.0

It's appearing because it's showing the context of the gallery creation, but it is rather pointless, since it's the only option available. It doesn't do anything because there are no alternatives available.

Setting the version to 5.0 for now, I'm guessing this has existed since galleries showed up in the block editor, but I'll have to research that later.

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


5 months ago

#4 @ruchirj
4 months ago

  • Keywords changes-requested needs-testing added

Hello i just change the code and it's working for all block who have no action menu here is below,

before changes:


	_menu: function() {
		var menu = this.frame.menu,
			mode = this.get('menu'),
			actionMenuItems,
			actionMenuLength,
			view;

		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 ) {
			return;
		}

		menu.mode( mode );

		view = menu.get();
		if ( view && view.select ) {
			view.select( this.id );
		}
	},

and after changes :

	_menu: function() {
		var menu = this.frame.menu,
			mode = this.get('menu'),
			actionMenuItems,
			actionMenuLength,
			view,
            actionMenuItems = this.frame.menu.get('views'),
			actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0;

		if ( this.frame.menu ) {
			// 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 || actionMenuLength < 2) {
			return;
		}

		menu.mode( mode );

		view = menu.get();
		if ( view && view.select ) {
			view.select( this.id );
		}
	},

media-view.js
line 2282 to 2305.

Last edited 4 months ago by ruchirj (previous) (diff)

#5 @ruchirj
2 months ago

hello all any one look at this please.

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


8 weeks ago

This ticket was mentioned in Slack in #core by nhrrob. View the logs.


6 weeks ago

#8 @nhrrob
6 weeks ago

  • Keywords changes-requested removed

We have reviewed this in today's bug scrub.
Changes requested doesn't seem a valid keyword here.

Also a possible fix is given in https://core.trac.wordpress.org/ticket/60666#comment:4

Anyone wants to add a patch or PR?

@joedolson
5 weeks ago

Converts comment into patch

#9 follow-up: @joedolson
5 weeks ago

  • Keywords has-patch added

#11 @joedolson
5 weeks ago

I'm not sure this patch works as described; at least, not as far as I can tell. However, the original testing instructions also don't entirely make sense to me: I'm not sure what "From the 'File' block add the block 'Gallery', then select Media Library." means.

@ukdrahul Are you able to clarify the instructions for reproducing the issue? I'm not clear what the File block has to do with this.

#12 @shailu25
5 weeks ago

Here are the steps to reproduce the issue:

  • Create a new post/page.
  • Select the Gallery block and click on the Media Library option.
  • You will notice that the unwanted section appears in sidebar.
  • Added Attachment for Reference.
Last edited 5 weeks ago by shailu25 (previous) (diff)

@shailu25
5 weeks ago

Added Attchment

#13 @shailu25
5 weeks ago

Related: 58973

#14 @oglekler
5 weeks ago

  • Milestone changed from 6.6 to 6.7

We have RC1 and patch needs at least testing, so, I am moving it to the next milestone.

#15 in reply to: ↑ 9 @rsiddiqe
5 weeks ago

Replying to joedolson:

Hey, trying to implement the patch (60666.diff) on a fresh install of 6.5 and 5.5. Can't find the file to patch (state.js) within the installation directory.

The given path is src/js/media/controllers/state.js . However searching for 'state.js' within the WordPress installation directory finds no such file.

Am I doing something wrong here?

#16 @sudipatel007
4 weeks ago

  • Keywords needs-testing removed

Test Report

Description
I have added patch in my local and it is working fine - https://core.trac.wordpress.org/attachment/ticket/60666/60666.diff

Environment

  • WordPress: 6.6-RC1-58573
  • PHP: 8.1.23
  • Server: nginx/1.16.0
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.23)
  • Browser: Chrome 126.0.0.0 (macOS)
  • Theme: Twenty Nineteen 2.8

Results
Before Patch
https://prnt.sc/PyELnbnvbjLe

After Patch
Screenshot - https://prnt.sc/5KT-Vx2Tch_l
Video - https://www.loom.com/share/71aacf85758543c386440e45254563d1?sid=6997c9ed-e284-4a97-bc4d-2042e994303e

#17 @ukdrahul
4 weeks ago

@joedolson As the testing went well (done by @sudipatel007 ), I was wondering if we could try to resolve this minor bug in version 6.6 and finalize it. Would that be possible?

#18 @joedolson
4 weeks ago

@rsiddiqe You need to apply patches to the WordPress src directory; if you don't have a state.js file, then you're looking at a copy of WordPress that's already been built.

@ukdrahul No, now that we're in the release candidate phase nothing can be committed that isn't an issue introduced during the 6.6 cycle.

Note: See TracTickets for help on using tickets.