WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#37901 closed defect (bug) (fixed)

Multisite admin has duplicate HTML id's for ab-awaiting-mod

Reported by: drtonyb Owned by: Presskopp
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.6
Component: Toolbar Keywords: good-first-bug has-patch
Focuses: administration, multisite Cc:

Description

In a multisite installation, the admin bar contains duplicate HTML element id attribute's for span elements with id="ab-awaiting-mod". Fails HTML validation.

This is associated with site items in the My Sites menu and the Manage Comments sub-menu item on each site.

The problem is located in the file wp-includes/admin-bar.php within the function wp_admin_bar_comments_menu() on line 699 where a span element is assigned the same id attribute, "ab-waiting-mod", for each site in the multisite's My Sites menu.

HTML id attributes must be unique for a page, so either this id is made unique for each site in the My Sites menu (append the site ID or similar) or the id is removed (to me it appears that the id may not be of any use since it doesn't occur anywhere else in the wordpress core).

Attachments (1)

37901.diff (880 bytes) - added by Presskopp 4 years ago.

Download all attachments as: .zip

Change History (11)

#1 @SergeyBiryukov
4 years ago

  • Component changed from Administration to Toolbar

#2 @SergeyBiryukov
4 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 4.7

Introduced in [15671] as awaiting-mod, changed to ab-awaiting-mod in [16310], unused since [19516].

I think it's safe to remove it.

@Presskopp
4 years ago

#3 @Presskopp
4 years ago

  • Keywords has-patch added; needs-patch removed

Patch removes ID

#4 follow-up: @SergeyBiryukov
4 years ago

Hmm, I could not reproduce the original issue though.

wp_admin_bar_comments_menu() is only used in the main toolbar, not in "My Sites" menu.

The Manage Comments item in wp_admin_bar_my_sites_menu() does not have a duplicate ID.

#5 in reply to: ↑ 4 @drtonyb
4 years ago

Replying to SergeyBiryukov:

Hmm, I could not reproduce the original issue though.

wp_admin_bar_comments_menu() is only used in the main toolbar, not in "My Sites" menu.

The Manage Comments item in wp_admin_bar_my_sites_menu() does not have a duplicate ID.

My mistake - on further investigation I have found that the problem is not in the core function wp_admin_bar_my_sites_menu(). I've tracked to problem to a plugin called multisite-enhancements.

#6 @flixos90
4 years ago

  • Owner set to Presskopp
  • Status changed from new to assigned

#7 @Presskopp
4 years ago

I still think we can safely delete this id.

it doesn't occur anywhere else in the wordpress core

#8 @jeremyfelt
4 years ago

I found a handful of plugins and themes that relied on #ab-awaiting-mod to apply custom styles to the admin menu, but it seems that none have been updated since before the changes in [19516].

#9 @jeremyfelt
4 years ago

I'm going to go ahead and get this in. I don't believe it will cause an issue, and .awaiting-mod is also available as a better replacement.

#10 @jeremyfelt
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 38683:

Admin Bar: Remove unused ID ab-awaiting-mod from comment count.

This selector has been unused since [19516]. The (now) more appropriate .awaiting-mod is used instead.

Props Presskopp.
Fixes #37901.

Note: See TracTickets for help on using tickets.