What is the purpose of the “role” attribute in the WP themes?
For example, in the WP3 default theme we have this in footer.php
I searched for the string “contentinfo” and found that this is the only occurrence in the default theme folder.
What’s it’s purpose? How is it used?
role
is an XHTML attribute used to identify the context of elements on the page. The search bar will also render withrole="search"
on a WordPress site.You can read more about it at the W3C specification site.
To answer your specific question,
role="contentinfo"
identifies “Meta information about the content on the page or the page as a whole.”The role attribute itself can be used by other applications (i.e. screen readers) to determine the purpose of the elements on the page. It gives things a stronger meaning than the explicit names we use for element IDs (which aren’t codified in any way).
It is also part of the WAI-ARIA specification (Accessible Rich Internet Applications)
You can also read about it on the W3C Specifications site