mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 1392926 - Only expose the Region landmark role if a section element has been explicitly named by the author, r=surkov
MozReview-Commit-ID: 6B0TSy8lqck --HG-- extra : rebase_source : e79e1927eadb88ba107269effbdb3072427fc9ae
This commit is contained in:
parent
5782fcc756
commit
c00da5bfe0
@ -318,8 +318,7 @@ MARKUPMAP(q,
|
||||
|
||||
MARKUPMAP(section,
|
||||
New_HyperText,
|
||||
roles::SECTION,
|
||||
Attr(xmlroles, region))
|
||||
roles::SECTION)
|
||||
|
||||
MARKUPMAP(summary,
|
||||
New_HTMLSummary,
|
||||
|
@ -1175,6 +1175,13 @@ HyperTextAccessible::LandmarkRole() const
|
||||
return nsGkAtoms::main;
|
||||
}
|
||||
|
||||
// Only return xml-roles "region" if the section has an accessible name.
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::section)) {
|
||||
nsAutoString name;
|
||||
const_cast<HyperTextAccessible*>(this)->Name(name);
|
||||
return name.IsEmpty() ? nullptr : nsGkAtoms::region;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
testAbsentAttrs("article_footer", {"xml-roles": "contentinfo"});
|
||||
testAbsentAttrs("section_footer", {"xml-roles": "contentinfo"});
|
||||
testAttrs("aside", {"xml-roles": "complementary"}, true);
|
||||
testAttrs("section", {"xml-roles": "region"}, true);
|
||||
testAbsentAttrs("section", {"xml-roles": "region"}, true);
|
||||
testAttrs("main", {"xml-roles": "main"}, true); // // ARIA override
|
||||
testAttrs("form", {"xml-roles": "form"}, true);
|
||||
testAttrs("feed", {"xml-roles": "feed"}, true);
|
||||
|
@ -1156,14 +1156,23 @@
|
||||
testElm("samp_container", obj);
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// HTML:section
|
||||
// HTML:section without an accessible name
|
||||
|
||||
obj = {
|
||||
role: ROLE_SECTION,
|
||||
absentAttributes: { "xml-roles": "region" },
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ]
|
||||
};
|
||||
testElm("section", obj);
|
||||
|
||||
// HTML:section with an accessible name
|
||||
|
||||
obj = {
|
||||
role: ROLE_SECTION,
|
||||
attributes: { "xml-roles": "region" },
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ]
|
||||
};
|
||||
testElm("section", obj);
|
||||
testElm("named_section", obj);
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
// HTML:small contained by paragraph
|
||||
@ -1648,6 +1657,7 @@
|
||||
<p id="s_container">normal<s>striked</s></p>
|
||||
<p id="samp_container">normal<samp>sample</samp></p>
|
||||
<section id="section">section</section>
|
||||
<section id="named_section" aria-label="foo">named section</section>
|
||||
<p id="small_container">normal<small>small</small></p>
|
||||
<span id="span"></span>
|
||||
<p id="strong_container">normal<strong>strong</strong></p>
|
||||
|
@ -88,7 +88,7 @@
|
||||
<img id="image-2" src="../moz.png" alt="stuff">
|
||||
<div id="image-3" tabindex="0" role="img">Not actually an image</div>
|
||||
</section>
|
||||
<section>
|
||||
<section aria-label="Some region">
|
||||
<h4 id="heading-6" aria-hidden="true">Hidden header</h4>
|
||||
<a id="link-1" href="http://www.mozilla.org">Link</a>
|
||||
<a id="anchor-1">Words</a>
|
||||
|
Loading…
Reference in New Issue
Block a user