Open Bug 1813616 Opened 2 years ago Updated 1 year ago

Set accessibility focus on selected tab in TabsAdapter

Categories

(Firefox for Android :: Tabs, defect, P2)

All
Android
defect

Tracking

()

Accessibility Severity s3

People

(Reporter: boek, Unassigned, Mentored)

References

Details

(Keywords: access)

From github: https://github.com/mozilla-mobile/fenix/issues/19139.

When we draw the view holder items, we do not set the selected tab with accessibility focus. We can probably fix this by passing the isSelected flag into the Tab of the view holder. Then, when the view is attached, we can request focus on it. Without knowing the selected tab, we have to do some awkward checks first:

override fun onViewAttachedToWindow(holder: TabViewHolder) {
    val tabs = tabs ?: return super.onViewAttachedToWindow(holder)

    val isSelected = holder.tab?.id == tabs.list[tabs.selectedIndex].id

    if (isSelected) {
        holder.itemView.requestFocus()
        holder.itemView.sendAccessibilityEvent(
            AccessibilityEvent.TYPE_VIEW_FOCUSED
        )
    }

    super.onViewAttachedToWindow(holder)
}

┆Issue is synchronized with this Jira Task

Change performed by the Move to Bugzilla add-on.

Keywords: access
Mentor: nbond
Severity: -- → S3
Keywords: good-first-bug
Priority: -- → P2

I've confirmed that this is a bug in the Composified Tabs Tray, so this should be fixed there as well

While this issue is not a blocker, it is definitely a bump on the delightful use of the browser, since a screen reader user would have to review all tabs to find out which one is, in fact, selected. It would make the navigation unnecessary cumbersome for both the screen reader and the switch access and other alternative input sources users, including those with limited dexterity who are especially affected.

Accessibility Severity: --- → s3

Posting some notes from doing a couple hours of investigation today:

I tried two approaches

Approach 1 - Pass a boolean down from the tab list/grid root container to do a one-time focus request on the tab

  • Tab items themelves will perform the focus request use FocusRequester and Modifier.focusRequester

Result

  • The focus requester wasn’t working

Approach 2 - Attempt to use traversal groups in the Modifier.semantics node

  • The banner would have a traversal index to be placed after the tabs

Result:

  • Traversal order was seemingly not working either.
    • May need a simpler example of traversal groups before trying to apply it to something as complex as Tabs Tray.

Gave this another pass yesterday:

Approach - Passing down a focus requester

  • The TabGrid composable passed down a FocusRequester object to the TabGridItem
  • TabGridItem would attach it via Modifier.focusRequester()
  • A LaunchedEffect(Unit) would call focusRequester.requestFocus()

Result

  • The active/selected tab still did not receive focus (even when applying a delay)

I filed a companion bug to this bug as bug 1904430. When testing, it appears there is no way for a TalkBack user to know the current tab. This information is conveyed visually through the purple ring around the current tab, but not conveyed in TalkBack. (Not related to moving focus, but impacting the same user experience.)

See Also: → 1904430

@Noah, we were looking at this as part of the #mobile-community-outreach to audit our good-first-bug. Given that this is a talkback focus bug that already took several passes to determine the best approach, we're thinking this might not be a good-first-bug.

Keywords: good-first-bug
You need to log in before you can comment on or make changes to this bug.