From d30cbb29738ed0229ccf8a6dab4e2bdf8fb53ac3 Mon Sep 17 00:00:00 2001 From: Marco Zehe Date: Wed, 14 Aug 2019 06:10:24 +0000 Subject: [PATCH] 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 --- accessible/html/HTMLElementAccessibles.cpp | 10 +++++----- .../mochitest/attributes/test_xml-roles.html | 6 ++++++ .../tests/mochitest/elm/test_HTMLSpec.html | 8 ++++++++ .../tests/mochitest/jsat/test_landmarks.html | 19 +++++++++++++++++++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/accessible/html/HTMLElementAccessibles.cpp b/accessible/html/HTMLElementAccessibles.cpp index b01c880a90ea..6083636cd8b5 100644 --- a/accessible/html/HTMLElementAccessibles.cpp +++ b/accessible/html/HTMLElementAccessibles.cpp @@ -165,11 +165,11 @@ role HTMLHeaderOrFooterAccessible::NativeRole() const { // If other sectioning or sectioning root elements, they become sections. nsIContent* parent = mContent->GetParent(); while (parent) { - if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::aside, - nsGkAtoms::nav, nsGkAtoms::section, - nsGkAtoms::blockquote, nsGkAtoms::details, - nsGkAtoms::dialog, nsGkAtoms::fieldset, - nsGkAtoms::figure, nsGkAtoms::td)) { + if (parent->IsAnyOfHTMLElements( + nsGkAtoms::article, nsGkAtoms::aside, nsGkAtoms::nav, + nsGkAtoms::section, nsGkAtoms::main, nsGkAtoms::blockquote, + nsGkAtoms::details, nsGkAtoms::dialog, nsGkAtoms::fieldset, + nsGkAtoms::figure, nsGkAtoms::td)) { break; } parent = parent->GetParent(); diff --git a/accessible/tests/mochitest/attributes/test_xml-roles.html b/accessible/tests/mochitest/attributes/test_xml-roles.html index 29e3e7ce6685..77c0c18d6b11 100644 --- a/accessible/tests/mochitest/attributes/test_xml-roles.html +++ b/accessible/tests/mochitest/attributes/test_xml-roles.html @@ -21,9 +21,11 @@ testAttrs("nav", {"xml-roles": "navigation"}, true); testAttrs("header", {"xml-roles": "banner"}, true); testAbsentAttrs("article_header", {"xml-roles": "banner"}); + testAbsentAttrs("main_header", {"xml-roles": "banner"}); testAbsentAttrs("section_header", {"xml-roles": "banner"}); testAttrs("footer", {"xml-roles": "contentinfo"}, true); testAbsentAttrs("article_footer", {"xml-roles": "contentinfo"}); + testAbsentAttrs("main_footer", {"xml-roles": "contentinfo"}); testAbsentAttrs("section_footer", {"xml-roles": "contentinfo"}); testAttrs("aside", {"xml-roles": "complementary"}, true); testAbsentAttrs("section", {"xml-roles": "region"}, true); @@ -157,6 +159,10 @@
a header within an article
+
+
a header within a main
+
a footer within a main
+