Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Make loading page progress bar accessible to TalkBack. #2526

Merged
merged 1 commit into from Mar 28, 2019

Conversation

eeejay
Copy link
Contributor

@eeejay eeejay commented Mar 26, 2019

ProgressBars can be made accessible to TalkBack by setting android:accessibilityLiveRegion.
They will emit TYPE_VIEW_SELECTED events. TalkBack will format those events into percentage
announcements along with a pitch-change earcon. We are not using that feature here for
several reasons:

  1. They are dispatched via a 200ms timeout. Since loading a page can be a short process,
    and since we only update the bar a handful of times, these events often never fire and
    they don't give the user a true sense of the progress.
  2. The last 100% event is dispatched after the view is hidden. This prevents the event
    from being fired, so the user never gets a "complete" event.
  3. Live regions in TalkBack have their role announced, so the user will hear
    "Progress bar, 25%". For a common feature like page load this is very chatty and unintuitive.
  4. We can provide custom strings instead of the less useful percentage utterance, but
    TalkBack will not play an earcon if an event has its own text.

For all those reasons, we are going another route here with a "loading" announcement
when the progress bar first appears along with scroll events that have the same
pitch-change earcon in TalkBack (although they are a bit louder). This gives a concise and
consistent feedback to the user that they can depend on.

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

@eeejay eeejay requested a review from a team as a code owner March 26, 2019 16:26
Copy link
Contributor

@pocmo pocmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one lint issue that should be fixed after #2508 lands.

components/browser/toolbar/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
@eeejay eeejay force-pushed the page-loading-progress-a11y branch from 741b50c to 99e3c66 Compare March 26, 2019 18:17
@codecov
Copy link

codecov bot commented Mar 26, 2019

Codecov Report

Merging #2526 into master will increase coverage by 0.62%.
The diff coverage is 81.81%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2526      +/-   ##
============================================
+ Coverage      82.5%   83.12%   +0.62%     
+ Complexity     2877     2815      -62     
============================================
  Files           354      348       -6     
  Lines         12129    11778     -351     
  Branches       1786     1719      -67     
============================================
- Hits          10007     9791     -216     
+ Misses         1382     1265     -117     
+ Partials        740      722      -18
Impacted Files Coverage Δ Complexity Δ
...mponents/browser/toolbar/display/DisplayToolbar.kt 93.08% <81.81%> (-0.18%) 41 <3> (+1)
...lla/components/service/glean/DatetimeMetricType.kt 77.41% <0%> (-16.13%) 19% <0%> (-1%)
...nts/service/glean/firstrun/FileFirstRunDetector.kt 88.23% <0%> (-11.77%) 6% <0%> (ø)
...onents/service/glean/storages/PingStorageEngine.kt 70% <0%> (-6.09%) 14% <0%> (+2%)
...ain/java/mozilla/components/service/glean/Glean.kt 85.88% <0%> (-5.96%) 1% <0%> (ø)
...nents/browser/storage/sync/PlacesHistoryStorage.kt 94.54% <0%> (-3.13%) 19% <0%> (+2%)
...a/components/browser/toolbar/facts/ToolbarFacts.kt 91.66% <0%> (-2.78%) 0% <0%> (ø)
...ents/service/glean/storages/EventsStorageEngine.kt 83.01% <0%> (-0.61%) 15% <0%> (-11%)
...s/browser/storage/memory/InMemoryHistoryStorage.kt 89.28% <0%> (-0.37%) 30% <0%> (-4%)
...a/components/service/glean/net/HttpPingUploader.kt 95.45% <0%> (ø) 9% <0%> (ø) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8831fac...2cb9cb3. Read the comment docs.

@eeejay eeejay force-pushed the page-loading-progress-a11y branch from 99e3c66 to 4c37253 Compare March 26, 2019 18:21
@eeejay eeejay force-pushed the page-loading-progress-a11y branch from 4c37253 to 2cb9cb3 Compare March 28, 2019 23:18
@jonalmeida jonalmeida merged commit db229c9 into mozilla-mobile:master Mar 28, 2019
@Pike
Copy link
Contributor

Pike commented Apr 2, 2019

Fly-by comment, I see that this patch landed localizations, too. Those don't get synchronized to the l10n process, and won't be seen by the l10n community.

If you're up to contribute localizations for your patches, doing so on Pontoon will be more transparent.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants