[wp-trac] [WordPress Trac] #40359: allow arbitrary HTML attributes on <a> produced by Walker_Page
WordPress Trac
noreply at wordpress.org
Mon May 1 23:14:54 UTC 2017
#40359: allow arbitrary HTML attributes on <a> produced by Walker_Page
-------------------------+-----------------------------
Reporter: pbiron | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Menus | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: accessibility
-------------------------+-----------------------------
Comment (by pbiron):
@SergeyBiryukov I avoid filters that require {{{preg_replace()}}} on
generated markup to accomplish their goals like the plague...they are too
fraught with error, e.g., when something else has hooked into it with a
higher priority and inserted additional markup between the close of one
tag and the opening of another.
Since I originally opened this ticket I have abandoned the
{{{Walker_Page}}} sublcass workaround in favor of a jQuery workaround:
{{{
(function ($) {
$('li.current_page_item a').attr ('aria-current', 'page') ;
})(jQuery)
}}}
when it was confirmed by the team that does our WAI reviews that screen
readers see such jQuery DOM manipulations.
While my current jQuery workaround works (and is simpler), I would still
greatly prefer the proposed {{{page_menu_link_attributes}}} filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40359#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list