[wp-trac] [WordPress Trac] #37968: HTML validation errors in admin tool
WordPress Trac
noreply at wordpress.org
Sun Sep 25 20:33:23 UTC 2016
#37968: HTML validation errors in admin tool
----------------------------+-----------------------------
Reporter: mdgl | Owner: SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 4.7
Component: Administration | Version: trunk
Severity: normal | Resolution:
Keywords: | Focuses:
----------------------------+-----------------------------
Comment (by mdgl):
I found another similar validation problem in the Appearance - Menus
screen. It's tempting to ask who tests this stuff, but in fact modern
browsers are very relaxed with HTML parsing and seem to correct obvious
errors automatically, so in practice this kind of bug is becoming very
difficult to spot!
Class `Walker_Nav_Menu_Edit` is used to populate the "Menu Structure"
panel with the menu to be edited. If the menu contains nested items,
however the current code attempts to output a nested list of just `<li>`
elements which is not valid HTML without an intervening `<ul>` (or
`<ol>`).
The solution I think is to follow the example of class
`Walker_Nav_Menu_Checklist` and override the `start_lvl()` and `end_lvl()`
methods to output the necessary additional `<ul>` and `</ul>` markup. See
the forthcoming patch for a suggestion. Tab indents and closing tag
comments could perhaps be further improved.
Unfortunately, this change also causes the display of the nested menu
items to be indented rather more than previously. Some CSS changes are
probably required as well, but I'm not sure of the best place to do that -
the current CSS seems rather over-specified, perhaps as a result of trying
to work around the invalid markup.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37968#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list