[wp-trac] Re: [WordPress Trac] #10108: Invalid HTML in
get_search_form()
WordPress Trac
wp-trac at lists.automattic.com
Wed Jun 17 15:51:21 GMT 2009
#10108: Invalid HTML in get_search_form()
-----------------------------------------------------+----------------------
Reporter: kchrist | Type: defect (bug)
Status: new | Priority: normal
Milestone: 2.8.1 | Component: Template
Version: 2.8 | Severity: normal
Keywords: needs-patch close html search templates |
-----------------------------------------------------+----------------------
Changes (by Elpie):
* cc: Elpie (added)
Comment:
Replying to [comment:2 ryan]:
> Those are WAI-ARIA landmark roles, which always generate debate. :-) See
#9408.
You know, WordPress uses so much JavaScript that adding roles through js
would work, while also satisfying those who want to output validating
X/HTML.
I've been using this successfully for awhile:
{{{
function setRoleAttribute(id, rolevalue) {
if(document.getElementById(id)) {
document.getElementById(id).setAttribute("role",
rolevalue);
}
}
function setAriaRoleElementsById() {
//Add all Id:s and aria roles here
setRoleAttribute("header", "banner");
setRoleAttribute("content", "main");
setRoleAttribute("sidebar", "complementary");
setRoleAttribute("footer", "contentinfo");
setRoleAttribute("menu", "navigation");
setRoleAttribute("searchform", "search");
}
window.onload=function(){ setAriaRoleElementsById(); }
}}}
It's accessible to assistive devices and browsers. The roles are not
output if JavaScript is off, but if its off WAI-ARIA roles and properties
are not needed either.
The other advantage of adding the roles through js is that as new roles
are defined, updating the script is much easier than hunting through the
code to hardcode them.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10108#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list