Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#37901 closed defect (bug) (fixed)

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

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

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 10 years ago.

Download all attachments as: .zip

Change History (11)

#1 @SergeyBiryukov
10 years ago

  • Component Administration → Toolbar

#2 @SergeyBiryukov
10 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone Awaiting Review → 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
10 years ago

#3 @Presskopp
10 years ago

  • Keywords has-patch added; needs-patch removed

Patch removes ID

#4 follow-up: @SergeyBiryukov
10 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
10 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
10 years ago

  • Owner set to Presskopp
  • Status new → assigned

#7 @Presskopp
10 years ago

I still think we can safely delete this id.

it doesn't occur anywhere else in the wordpress core

#8 @jeremyfelt
10 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
10 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
10 years ago

  • Resolution → fixed
  • Status assigned → 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.