Bug 1573750 - If header or footer elements are descendants of the main element, do not expose them as landmarks, r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D41893

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Marco Zehe 2019-08-14 06:10:24 +00:00
Родитель 1373bb3701
Коммит d30cbb2973
4 изменённых файлов: 38 добавлений и 5 удалений

Просмотреть файл

@ -165,11 +165,11 @@ role HTMLHeaderOrFooterAccessible::NativeRole() const {
// If other sectioning or sectioning root elements, they become sections. // If other sectioning or sectioning root elements, they become sections.
nsIContent* parent = mContent->GetParent(); nsIContent* parent = mContent->GetParent();
while (parent) { while (parent) {
if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::aside, if (parent->IsAnyOfHTMLElements(
nsGkAtoms::nav, nsGkAtoms::section, nsGkAtoms::article, nsGkAtoms::aside, nsGkAtoms::nav,
nsGkAtoms::blockquote, nsGkAtoms::details, nsGkAtoms::section, nsGkAtoms::main, nsGkAtoms::blockquote,
nsGkAtoms::dialog, nsGkAtoms::fieldset, nsGkAtoms::details, nsGkAtoms::dialog, nsGkAtoms::fieldset,
nsGkAtoms::figure, nsGkAtoms::td)) { nsGkAtoms::figure, nsGkAtoms::td)) {
break; break;
} }
parent = parent->GetParent(); parent = parent->GetParent();

Просмотреть файл

@ -21,9 +21,11 @@
testAttrs("nav", {"xml-roles": "navigation"}, true); testAttrs("nav", {"xml-roles": "navigation"}, true);
testAttrs("header", {"xml-roles": "banner"}, true); testAttrs("header", {"xml-roles": "banner"}, true);
testAbsentAttrs("article_header", {"xml-roles": "banner"}); testAbsentAttrs("article_header", {"xml-roles": "banner"});
testAbsentAttrs("main_header", {"xml-roles": "banner"});
testAbsentAttrs("section_header", {"xml-roles": "banner"}); testAbsentAttrs("section_header", {"xml-roles": "banner"});
testAttrs("footer", {"xml-roles": "contentinfo"}, true); testAttrs("footer", {"xml-roles": "contentinfo"}, true);
testAbsentAttrs("article_footer", {"xml-roles": "contentinfo"}); testAbsentAttrs("article_footer", {"xml-roles": "contentinfo"});
testAbsentAttrs("main_footer", {"xml-roles": "contentinfo"});
testAbsentAttrs("section_footer", {"xml-roles": "contentinfo"}); testAbsentAttrs("section_footer", {"xml-roles": "contentinfo"});
testAttrs("aside", {"xml-roles": "complementary"}, true); testAttrs("aside", {"xml-roles": "complementary"}, true);
testAbsentAttrs("section", {"xml-roles": "region"}, true); testAbsentAttrs("section", {"xml-roles": "region"}, true);
@ -157,6 +159,10 @@
<header id="article_header">a header within an article</header> <header id="article_header">a header within an article</header>
<footer id="article_footer">a footer within an article</footer> <footer id="article_footer">a footer within an article</footer>
</article> </article>
<main id="main_with_header_and_footer">
<header id="main_header">a header within a main</header>
<footer id="main_footer">a footer within a main</footer>
</main>
<section id="section_with_header_and_footer"> <section id="section_with_header_and_footer">
<header id="section_header">a header within an section</header> <header id="section_header">a header within an section</header>
<footer id="section_footer">a footer within an section</footer> <footer id="section_footer">a footer within an section</footer>

Просмотреть файл

@ -526,6 +526,7 @@
}; };
testElm("footer_in_article", obj); testElm("footer_in_article", obj);
testElm("footer_in_aside", obj); testElm("footer_in_aside", obj);
testElm("footer_in_main", obj);
testElm("footer_in_nav", obj); testElm("footer_in_nav", obj);
testElm("footer_in_section", obj); testElm("footer_in_section", obj);
testElm("footer_in_blockquote", obj); testElm("footer_in_blockquote", obj);
@ -628,6 +629,7 @@
}; };
testElm("header_in_article", obj); testElm("header_in_article", obj);
testElm("header_in_aside", obj); testElm("header_in_aside", obj);
testElm("header_in_main", obj);
testElm("header_in_nav", obj); testElm("header_in_nav", obj);
testElm("header_in_section", obj); testElm("header_in_section", obj);
testElm("header_in_blockquote", obj); testElm("header_in_blockquote", obj);
@ -1554,6 +1556,9 @@
<aside> <aside>
<footer id="footer_in_aside">Some copyright info</footer> <footer id="footer_in_aside">Some copyright info</footer>
</aside> </aside>
<main>
<footer id="footer_in_main">Some copyright info</footer>
</main>
<nav> <nav>
<footer id="footer_in_nav">Some copyright info</footer> <footer id="footer_in_nav">Some copyright info</footer>
</nav> </nav>
@ -1600,6 +1605,9 @@
<aside> <aside>
<header id="header_in_aside">Not logo</header> <header id="header_in_aside">Not logo</header>
</aside> </aside>
<main>
<header id="header_in_main">Not logo</header>
</main>
<nav> <nav>
<header id="header_in_nav">Not logo</header> <header id="header_in_nav">Not logo</header>
</nav> </nav>

Просмотреть файл

@ -59,6 +59,21 @@
expectedBraille: [ expectedBraille: [
["a footer within an article"], ["a footer within an article"],
["a footer within an article"]], ["a footer within an article"]],
}, {
accOrElmOrID: "main_header",
expectedUtterance: [["a header within main content"],
["a header within main content"]],
expectedBraille: [
["a header within main content"],
["a header within main content"]],
}, {
accOrElmOrID: "main_footer",
expectedUtterance: [
["a footer within main content"],
["a footer within main content"]],
expectedBraille: [
["a footer within main content"],
["a footer within main content"]],
}, { }, {
accOrElmOrID: "section_header", accOrElmOrID: "section_header",
expectedUtterance: [["a header within a section"], expectedUtterance: [["a header within a section"],
@ -159,6 +174,10 @@
<header id="article_header">a header within an article</header> <header id="article_header">a header within an article</header>
<footer id="article_footer">a footer within an article</footer> <footer id="article_footer">a footer within an article</footer>
</article> </article>
<main id="main_with_header_and_footer">
<header id="main_header">a header within main content</header>
<footer id="main_footer">a footer within main content</footer>
</main>
<section id="section_with_header_and_footer"> <section id="section_with_header_and_footer">
<header id="section_header">a header within a section</header> <header id="section_header">a header within a section</header>
<footer id="section_footer">a footer within a section</footer> <footer id="section_footer">a footer within a section</footer>