-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AppBarLayout] Use an accessibility delegate to add and perform actions
This replaces the use of `ViewCompat#add/removeAccessibilityAction` Both are valid strategies, but each call to `remove` or `add` triggers an accessibility event. Since this check is done in layout (originally to fix a11y scroll state) it's sending a high number of events that create noise for accessibility services. To avoid this, we move this code to the delegate `onInitialize` and `performAction` methods. Instead of the view dynamically adding and removing actions to itself, the node is initialized with actions only when an a11y service sends a request with a new node (likely due to some UI change). The flow here would look like: 1. UI is scrolled/page is loaded 2. TalkBack gets a scroll event/content change event 3. TalkBack requests new snapshot of the screen 4. ABL populates the node with the actions For a simple scroll, this change reduces the events from ~40 to ~10. We also add the Truth library for clearer assertions. PiperOrigin-RevId: 605333170 (cherry picked from commit 8a71e77)
- Loading branch information
1 parent
5efdae3
commit 929c80f
Showing
2 changed files
with
96 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters