Bug 1453555: Fix accessibility group info for <select size="1"> options. r?surkov draft
authorJames Teh <jteh@mozilla.com>
Thu, 12 Apr 2018 16:32:19 +1000
changeset 781509 b756c29d323cf4b588e25a726d7134ab2f42de10
parent 780587 cfe6399e142c71966ef58a16cfd52c0b46dc6b1e
push id106321
push userbmo:jteh@mozilla.com
push dateFri, 13 Apr 2018 00:52:59 +0000
reviewerssurkov
bugs1453555
milestone61.0a1
Bug 1453555: Fix accessibility group info for <select size="1"> options. r?surkov In the e10s implementation, Accessible::NativeState for the options doesn't include the invisible state. (It does with e10s disabled.) In HTMLSelectOptionAccessible::NativeState, rather than just flipping (xor) the invisible state, absolutely ensure it gets removed. We don't want to *add* the invisible state if it isn't there. This allows group position info to be calculated correctly. MozReview-Commit-ID: LPEVhOOm2NT
accessible/html/HTMLSelectAccessible.cpp
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -193,17 +193,20 @@ HTMLSelectOptionAccessible::NativeState(
 
   if (selectState & states::OFFSCREEN) {
     state |= states::OFFSCREEN;
   } else if (selectState & states::COLLAPSED) {
     // <select> is COLLAPSED: add OFFSCREEN, if not the currently
     // visible option
     if (!selected) {
       state |= states::OFFSCREEN;
-      state ^= states::INVISIBLE;
+      // Ensure the invisible state is removed. Otherwise, group info will skip
+      // this option. Furthermore, this gets cached and this doesn't get
+      // invalidated even once the select is expanded.
+      state &= ~states::INVISIBLE;
     } else {
       // Clear offscreen and invisible for currently showing option
       state &= ~(states::OFFSCREEN | states::INVISIBLE);
       state |= selectState & states::OPAQUE1;
     }
   } else {
     // XXX list frames are weird, don't rely on Accessible's general
     // visibility implementation unless they get reimplemented in layout