From 54d452c364f16f51223259d4dda0340102a60802 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 1 Jul 2026 17:55:36 +0200 Subject: [PATCH] Fix accessibility: remove TalkBack reverseLayout workaround (#6392) The LazyColumn was using reverseLayout=false when TalkBack was active to work around a Compose accessibility traversal bug. This placed new messages at the top of the screen, distorting the reading order for TalkBack users. With Compose BOM 2026.06.00, reverseLayout=true now works correctly with TalkBack traversal, so remove both workarounds: - Always use reverseLayout=true in TimelineView - Remove the .reversed() for expanded groups in TimelineItemGroupedEventsRow Note: this change should be manually tested with TalkBack to verify correct traversal order (oldest messages first, newest last). Co-Authored-By: Claude Sonnet 4.6 --- .../features/messages/impl/timeline/TimelineView.kt | 6 +----- .../timeline/components/TimelineItemGroupedEventsRow.kt | 9 +-------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt index 0a306aea1c..3b870ef839 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt @@ -77,7 +77,6 @@ import io.element.android.libraries.matrix.api.user.MatrixUser import io.element.android.libraries.testtags.TestTags import io.element.android.libraries.testtags.testTag import io.element.android.libraries.ui.strings.CommonStrings -import io.element.android.libraries.ui.utils.a11y.isTalkbackActive import io.element.android.wysiwyg.link.Link import kotlinx.coroutines.delay import kotlinx.coroutines.flow.collectLatest @@ -128,9 +127,6 @@ fun TimelineView( val context = LocalContext.current val toastMessage = stringResource(CommonStrings.common_copied_to_clipboard) val view = LocalView.current - // Disable reverse layout when TalkBack is enabled to avoid incorrect ordering issues seen in the current Compose UI version - val useReverseLayout = !isTalkbackActive() - fun inReplyToClick(eventId: EventId) { state.eventSink(TimelineEvent.FocusOnEvent(eventId)) } @@ -158,7 +154,7 @@ fun TimelineView( .nestedScroll(nestedScrollConnection) .testTag(TestTags.timeline), state = lazyListState, - reverseLayout = useReverseLayout, + reverseLayout = true, contentPadding = PaddingValues(top = 64.dp, bottom = 8.dp), ) { items( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemGroupedEventsRow.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemGroupedEventsRow.kt index b41e66ae82..4a200f01f7 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemGroupedEventsRow.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemGroupedEventsRow.kt @@ -34,7 +34,6 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.timeline.Timeline import io.element.android.libraries.matrix.api.user.MatrixUser -import io.element.android.libraries.ui.utils.a11y.isTalkbackActive import io.element.android.wysiwyg.link.Link @Composable @@ -158,13 +157,7 @@ private fun TimelineItemGroupedEventsRowContent( ) if (isExpanded) { Column { - timelineItem.events.let { - if (isTalkbackActive()) { - it.reversed() - } else { - it - } - }.forEach { subGroupEvent -> + timelineItem.events.forEach { subGroupEvent -> TimelineItemRow( timelineMode = timelineMode, timelineItem = subGroupEvent,