Fix crash when a list updates while a screen reader reads an item - #1995
Open
mehranlatifi83 wants to merge 1 commit into
Open
Fix crash when a list updates while a screen reader reads an item#1995mehranlatifi83 wants to merge 1 commit into
mehranlatifi83 wants to merge 1 commit into
Conversation
oldeepsmile-beep
approved these changes
Jul 30, 2026
mehranlatifi83
force-pushed
the
fix/talkback-list-update-crash
branch
from
July 31, 2026 14:16
931ddce to
51e033a
Compare
oldeepsmile-beep
approved these changes
Jul 31, 2026
oldeepsmile-beep
approved these changes
Jul 31, 2026
|
@oldeepsmile-beep hi. Can this be merged? we always had problems why no one pays any attention to pull requests opened here. About accessibility, no one pays any attention to us, So we just started to send the pull requests our selves. |
A content changed event dispatched at the end of a layout pass makes the framework build the node info of the focused item right away, which asks the layout manager for item positions that the finished layout has not settled yet and throws IndexOutOfBoundsException. It shows up when messages load underneath a screen reader, for example after opening a message from search or scrolling comments. Ignore the layout manager while positions are still pre layout, the same way pending adapter updates are already ignored, and treat a position that no longer exists as unknown instead of throwing.
mehranlatifi83
force-pushed
the
fix/talkback-list-update-crash
branch
from
August 3, 2026 17:16
51e033a to
da2bd14
Compare
oldeepsmile-beep
approved these changes
Aug 5, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With a screen reader running, the app crashes from time to time when a list updates underneath it, most reliably when messages load into an empty chat that was opened from search, from a global search result or from a comment thread, and when scrolling to the end of comments loads more.
The list dispatches a content changed event from inside its layout pass. Because a screen reader holds accessibility focus on an item, the framework builds that item's node info right away, which asks the layout manager for the item position while the ongoing layout has not settled positions yet, and the stale position is out of range for the new state. Without a screen reader the node is never built, which is why it only happens with one running.
The delegate already ignores the layout manager while adapter updates are pending. This extends the same guard to a running layout pass. The node is filled again once the layout is over, so nothing is lost for the screen reader.