html - Should A WordPress Post Thumbnail Have role="presentation" in it? -
i writing theme new site , want friendly can assistive technologies. such, wondering including role="presentation"
in display of call of post thumbnail.
the html generated php looks follows:
<figure class="featured-image"> <a href="{permalink}"> <img src="{featured image}" alt="{description}"> </a> </figure>
should include role="presentation"
and, if so, should go in <figure>
element?
if @ w3 specification roles:
[role="presentation"] negates implicit 'heading' role semantics not affect contents.
<h1 role="presentation"> sample content </h1>
there no implicit role span, contents
<span> sample content </span>
this role declaration redundant.
<span role="presentation"> sample content </span>
in cases, element contents exposed accessibility apis without implied role semantics.
sample content
saying role="presentation"
has given heading, state either <figure>
or <figcaption>
use role here.
however:
if element role of presentation focusable, user agents must ignore normal effect of role , expose element implicit native semantics, in order ensure element both understandable , operable. authors should not provide meaningful alternative text (for example, use alt="" in html4) when presentation role applied image.
since we're having alt tag on image, it's redundant use role="presentation"
well, , leave <figure>
. is, if wish use it, because seems little on top, quoting w3 again on role="presenation"
:
an element implicit native role semantics not mapped accessibility api.
since image gets mapped, , figure using figcaption explain it's content further, i'd not have use role="presenation"
here.
source: w3c on roles
Comments
Post a Comment