Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#28936 closed defect (bug) (fixed)

Plugin submenu first item has strange behaviors

Reported by: mikehansenme's profile MikeHansenMe Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

When testing the current version of trunk I found that any plugins that add menu items have strange behaviours. The first item has the same hover effects as top level even though it is in the submenu. To reproduce install Jetpack on trunk.

The lines that seem to have changed in trunk are:

- <li class="wp-first-item">
	<a class="wp-first-item" href="admin.php?page=jetpack">Jetpack</a>

+ <li class="wp-first-item menu-top toplevel_page_jetpack">
	<a class="wp-first-item menu-top toplevel_page_jetpack" href="admin.php?page=jetpack">Jetpack</a>

Attachments (7)

jetpack-submenu-391.png (59.2 KB) - added by MikeHansenMe 11 years ago.
Jetpack on 391
jetpack-submenu-trunk.png (57.6 KB) - added by MikeHansenMe 11 years ago.
Jetpack on trunk
mojo-submenu-trunk.png (58.5 KB) - added by MikeHansenMe 11 years ago.
another effected plugin
28936.diff (484 bytes) - added by MikeHansenMe 11 years ago.
28936.png (17.1 KB) - added by SergeyBiryukov 11 years ago.
28936.2.diff (733 bytes) - added by SergeyBiryukov 11 years ago.
28936.3.diff (566 bytes) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (15)

@MikeHansenMe
11 years ago

Jetpack on 391

@MikeHansenMe
11 years ago

Jetpack on trunk

@MikeHansenMe
11 years ago

another effected plugin

#1 @MikeHansenMe
11 years ago

It looks like plugins that use CPTs are not effected. Only when add_menu_page is used.

@MikeHansenMe
11 years ago

@SergeyBiryukov
11 years ago

#3 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 4.0

Confirmed. It's hard to see the difference on these screenshots, here's a larger one: 28936.png.

I don't think reverting [28778]/[29083] is the best fix here, let's see if there's another way.

#4 @SergeyBiryukov
11 years ago

  • Keywords has-patch commit added

Caused by add_submenu_page() copying the parent item, including classes:
tags/3.9.1/src/wp-admin/includes/plugin.php#L1122.

I think we can just skip adding custom classes for the first submenu item, see 28936.2.diff.

#5 @SergeyBiryukov
11 years ago

A better fix would probably be to avoid copying classes in add_submenu_page(). See 28936.3.diff.

#6 @MikeHansenMe
11 years ago

Just tested 28936.3.diff and it works great.

#7 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 29326:

In add_submenu_page(), avoid inadvertently copying classes of a menu item to the first submenu item.

fixes #28936.

This ticket was mentioned in IRC in #wordpress-dev by rboren. View the logs.


11 years ago

Note: See TracTickets for help on using tickets.