WordPress.org

Making WordPress.org

Opened 2 years ago

Closed 2 years ago

#2371 closed defect (fixed)

HTML parsing issue in handbooks

Reported by: samuelsidler Owned by: coffee2code
Milestone: Priority: normal
Component: Handbooks Keywords: has-patch
Cc:

Description (last modified by samuelsidler)

The handbooks menu in the sidebar (e.g. "Contents" on make/themes) shows the following code:

<h1 class="widget-title">Contents</h2>

Note the error? Okay, there's two:

  1. The opening and closing tags should match.
  2. The headings shouldn't be an <h1> at all, for accessibility purposes.

Attachments (1)

meta-2371.patch (821 bytes) - added by SergeyBiryukov 2 years ago.

Download all attachments as: .zip

Change History (11)

#1 @samuelsidler
2 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
2 years ago

  • Keywords has-patch added

The opening tag is in WPorg_Handbook::handbook_sidebar(), and the closing tag is in WPorg_Handbook_Pages_Widget::widget().

<h1> was introduced in [3686], register_sidebar() default is <h2 class="widgettitle">.

meta-2371.patch changes it back to <h2>.

#3 @samuelsidler
2 years ago

Does it make sense as an <h2> even? Or should it be something more like a <nav>?

#4 @coffee2code
2 years ago

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

In 4626:

Handbook plugin: Use h2 as tag for widget titles instead of h1.

Props SergeyBiryukov.
Fixes #2371.

#5 @coffee2code
2 years ago

@samuelsidler: I wouldn't say the sidebar header should be <nav>, though a <nav> could be used to wrap the <ul> containing the widget's links (optionally including the <h2> widget header).

#6 @coffee2code
2 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This was undone by @pento in [4690], which reintroduces the mismatch widget title tags for the table of contents as reported here.

Naturally, that can be fixed while still retaining the revert that happened, but @samuelsidler expressed a desire not to use h1 for the widget title.

Also, the use of h1 messes up the style of the table of contents (aka "Chapters") title for DevHub handbooks (again, styling can be changed there if we're sticking with h1).

What was the reason for having h1 as the widget title tag instead of h2? (I'm assuming for o2, so I mean more specifically than that.)

#7 @samuelsidler
2 years ago

I'm guessing @pento had a change in his sandbox and overwrote the fix here by accident. :)

#8 @SergeyBiryukov
2 years ago

The revert of [4626] in [4690] looks accidental to me as well.

#9 @pento
2 years ago

In 4695:

Handbook: [4690] accidentally reverted [4626]. This commit reverts the revert part of that commit, reverting to the correct behaviour.

See #2371.

#10 @SergeyBiryukov
2 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.