Bug 996821 - Force semantic HTML elements to have accessible objects. r=surkov
☠☠ backed out by 18224f0cc4dd ☠ ☠
authorEitan Isaacson <eitan@monotonous.org>
Wed, 16 Apr 2014 18:27:00 -0700
changeset 179272 fceba10dc04b85c2abca0a429c6bb3012f48ca0e
parent 179271 31b7ff03d49665d2a12d232ce0da4a96eac921a9
child 179273 95120513fd8e6ef34dc5e7648d99f60c612055dc
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewerssurkov
bugs996821
milestone31.0a1
Bug 996821 - Force semantic HTML elements to have accessible objects. r=surkov
accessible/src/base/nsAccessibilityService.cpp
accessible/tests/mochitest/role/test_general.html
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1431,25 +1431,31 @@ nsAccessibilityService::CreateHTMLAccess
       }
     }
 
     return nullptr;
   }
 
   if (tag == nsGkAtoms::abbr ||
       tag == nsGkAtoms::acronym ||
+      tag == nsGkAtoms::article ||
+      tag == nsGkAtoms::aside ||
       tag == nsGkAtoms::blockquote ||
       tag == nsGkAtoms::form ||
+      tag == nsGkAtoms::footer ||
+      tag == nsGkAtoms::header ||
       tag == nsGkAtoms::h1 ||
       tag == nsGkAtoms::h2 ||
       tag == nsGkAtoms::h3 ||
       tag == nsGkAtoms::h4 ||
       tag == nsGkAtoms::h5 ||
       tag == nsGkAtoms::h6 ||
-      tag == nsGkAtoms::q) {
+      tag == nsGkAtoms::nav ||
+      tag == nsGkAtoms::q ||
+      tag == nsGkAtoms::section) {
     nsRefPtr<Accessible> accessible =
       new HyperTextAccessibleWrap(aContent, document);
     return accessible.forget();
   }
 
   if (tag == nsGkAtoms::label) {
     nsRefPtr<Accessible> accessible =
       new HTMLLabelAccessible(aContent, document);
--- a/accessible/tests/mochitest/role/test_general.html
+++ b/accessible/tests/mochitest/role/test_general.html
@@ -24,16 +24,25 @@
       // Test html:form.
       testRole("nav", ROLE_SECTION);
       testRole("header", ROLE_HEADER);
       testRole("footer", ROLE_FOOTER);
       testRole("article", ROLE_DOCUMENT);
       testRole("aside", ROLE_NOTE);
       testRole("section", ROLE_SECTION);
 
+      // Bug 996821
+      // Check that landmark elements get accessibles with styled overflow.
+      testRole("section_overflow", ROLE_SECTION);
+      testRole("nav_overflow", ROLE_SECTION);
+      testRole("header_overflow", ROLE_HEADER);
+      testRole("aside_overflow", ROLE_NOTE);
+      testRole("footer_overflow", ROLE_FOOTER);
+      testRole("article_overflow", ROLE_FOOTER);
+
       // test html:div
       testRole("sec", ROLE_SECTION);
 
       // Test html:blockquote
       testRole("quote", ROLE_SECTION);
 
       // Test html:h, all levels
       testRole("head1", ROLE_HEADING);
@@ -122,16 +131,29 @@
 
   <nav id="nav">a nav</nav>
   <header id="header">a header</header>
   <footer id="footer">a footer</footer>
   <article id="article">an article</article>
   <aside id="aside">by the way I am an aside</aside>
   <section id="section">a section</section>
 
+  <section style="overflow: hidden;" id="section_overflow">
+    <nav style="overflow: hidden;"
+         id="nav_overflow">overflow nav</nav>
+    <header style="overflow: hidden;"
+            id="header_overflow">overflow header</header>
+    <aside style="overflow: hidden;"
+           id="aside_overflow">overflow aside</aside>
+    <footer style="overflow: hidden;"
+            id="footer_overflow">overflow footer</footer>
+  </section>
+  <article style="overflow: hidden;"
+           id="article_overflow">overflow article</article>
+
   <p id="p">A paragraph for comparison.</p>
   <div id="sec">A normal div</div>
   <blockquote id="quote">A citation</blockquote>
   <h1 id="head1">A heading level 1</h1>
   <h2 id="head2">A heading level 2</h2>
   <h3 id="head3">A heading level 3</h3>
   <h4 id="head4">A heading level 4</h4>
   <h5 id="head5">A heading level 5</h5>