From bf57223d0561d8e349a9d5cb57cd4e1d95f30ece Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 Apr 2026 09:48:38 +0200 Subject: [PATCH 1/7] RoomListDeclineInviteMenu: limit room name Improve preview. Closes #6659 --- .../android/appconfig/ProtectionConfig.kt | 15 ++++++++ .../roomlist/RoomListDeclineInviteMenu.kt | 24 ++++++++----- ...ListStateDeclineInviteMenuShownProvider.kt | 36 +++++++++++++++++++ 3 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 appconfig/src/main/kotlin/io/element/android/appconfig/ProtectionConfig.kt create mode 100644 features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListStateDeclineInviteMenuShownProvider.kt diff --git a/appconfig/src/main/kotlin/io/element/android/appconfig/ProtectionConfig.kt b/appconfig/src/main/kotlin/io/element/android/appconfig/ProtectionConfig.kt new file mode 100644 index 0000000000..f6ad71eeb1 --- /dev/null +++ b/appconfig/src/main/kotlin/io/element/android/appconfig/ProtectionConfig.kt @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.appconfig + +object ProtectionConfig { + /** + * The maximum length of a room name, to limit attack vectors in room invite. + */ + const val MAX_ROOM_NAME_LENGTH = 128 +} diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt index 523e677a57..d641a06063 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt @@ -19,10 +19,13 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp +import io.element.android.appconfig.ProtectionConfig import io.element.android.compound.theme.ElementTheme import io.element.android.features.home.impl.R import io.element.android.features.home.impl.model.RoomListRoomSummary +import io.element.android.libraries.core.extensions.toSafeLength import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.designsystem.theme.components.Button @@ -44,7 +47,11 @@ fun RoomListDeclineInviteMenu( onDismissRequest = { eventSink(RoomListEvent.HideDeclineInviteMenu) }, ) { RoomListDeclineInviteMenuContent( - roomName = menu.roomSummary.name ?: menu.roomSummary.roomId.value, + roomName = menu.roomSummary.name?.toSafeLength( + maxLength = ProtectionConfig.MAX_ROOM_NAME_LENGTH, + ellipsize = true, + ) + ?: menu.roomSummary.roomId.value, onDeclineClick = { eventSink(RoomListEvent.HideDeclineInviteMenu) eventSink(RoomListEvent.DeclineInvite(menu.roomSummary, false)) @@ -112,16 +119,15 @@ private fun RoomListDeclineInviteMenuContent( } } -// TODO This component should be seen in [RoomListView] @Preview but it doesn't show up. -// see: https://issuetracker.google.com/issues/283843380 -// Remove this preview when the issue is fixed. @PreviewsDayNight @Composable -internal fun RoomListDeclineInviteMenuContentPreview() = ElementPreview { - RoomListDeclineInviteMenuContent( - roomName = "Room name", - onCancelClick = {}, - onDeclineClick = {}, +internal fun RoomListDeclineInviteMenuContentPreview( + @PreviewParameter(RoomListStateDeclineInviteMenuShownProvider::class) menu: RoomListState.DeclineInviteMenu.Shown, +) = ElementPreview { + RoomListDeclineInviteMenu( + menu = menu, + canReportRoom = false, onDeclineAndBlockClick = {}, + eventSink = {}, ) } diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListStateDeclineInviteMenuShownProvider.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListStateDeclineInviteMenuShownProvider.kt new file mode 100644 index 0000000000..73d4785e96 --- /dev/null +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListStateDeclineInviteMenuShownProvider.kt @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.home.impl.roomlist + +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import androidx.compose.ui.tooling.preview.datasource.LoremIpsum +import io.element.android.features.home.impl.model.RoomListRoomSummary +import io.element.android.features.home.impl.model.aRoomListRoomSummary + +open class RoomListStateDeclineInviteMenuShownProvider : PreviewParameterProvider { + override val values: Sequence + get() = sequenceOf( + aDeclineInviteMenuShown(), + aDeclineInviteMenuShown( + aRoomListRoomSummary( + name = LoremIpsum(500).values.first(), + ) + ), + aDeclineInviteMenuShown( + aRoomListRoomSummary( + name = null, + ) + ), + ) +} + +internal fun aDeclineInviteMenuShown( + roomSummary: RoomListRoomSummary = aRoomListRoomSummary(), +) = RoomListState.DeclineInviteMenu.Shown( + roomSummary = roomSummary, +) From 09ff3294d5e22e0db34f5924fec5639f775811b4 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 Apr 2026 10:23:56 +0200 Subject: [PATCH 2/7] Ensure that all the ModalBottomSheet can scroll. --- .../configureroom/SelectParentSpaceOptions.kt | 3 ++- .../home/impl/roomlist/RoomListContextMenu.kt | 7 +++++- .../roomlist/RoomListDeclineInviteMenu.kt | 6 ++++- .../impl/spacefilters/SpaceFiltersView.kt | 3 ++- .../invitepeople/impl/InvitePeopleView.kt | 1 + .../impl/actionlist/ActionListView.kt | 1 + .../ResolveVerifiedUserSendFailureView.kt | 1 + .../messagecomposer/AttachmentsBottomSheet.kt | 6 ++++- .../CustomReactionBottomSheet.kt | 3 ++- .../reactionsummary/ReactionSummaryView.kt | 3 ++- .../bottomsheet/ReadReceiptBottomSheet.kt | 3 ++- .../impl/root/RolesAndPermissionsView.kt | 1 + .../impl/RoomMemberModerationView.kt | 7 +++++- .../joinbyaddress/JoinRoomByAddressView.kt | 6 ++++- .../components/SimpleModalBottomSheet.kt | 6 ++++- .../theme/components/ModalBottomSheet.kt | 22 +++++++++++++++++-- .../ui/components/AvatarActionBottomSheet.kt | 1 + .../CreateDmConfirmationBottomSheet.kt | 20 +++++++++++------ .../MediaDeleteConfirmationBottomSheet.kt | 3 ++- .../impl/details/MediaDetailsBottomSheet.kt | 1 + .../textcomposer/CaptionWarningBottomSheet.kt | 6 ++++- 21 files changed, 88 insertions(+), 22 deletions(-) diff --git a/features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/SelectParentSpaceOptions.kt b/features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/SelectParentSpaceOptions.kt index 6b7b66b897..1480e57334 100644 --- a/features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/SelectParentSpaceOptions.kt +++ b/features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/SelectParentSpaceOptions.kt @@ -95,7 +95,8 @@ internal fun SelectParentSpaceOptions( sheetState.hide(coroutineScope) { displaySelectSpaceBottomSheet = false } - } + }, + scrollable = false, ) { SelectParentSpaceBottomSheet( spaces = spaces, diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt index 30e3aaf0b7..569787c383 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt @@ -11,6 +11,8 @@ package io.element.android.features.home.impl.roomlist import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable @@ -43,6 +45,7 @@ fun RoomListContextMenu( ) { ModalBottomSheet( onDismissRequest = { eventSink(RoomListEvent.HideContextMenu) }, + scrollable = false, ) { RoomListModalBottomSheetContent( contextMenu = contextMenu, @@ -91,7 +94,9 @@ private fun RoomListModalBottomSheetContent( onReportRoomClick: () -> Unit, ) { Column( - modifier = Modifier.fillMaxWidth() + modifier = Modifier + .fillMaxWidth() + .verticalScroll(rememberScrollState()) ) { ListItem( headlineContent = { diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt index d641a06063..74462ec10c 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt @@ -13,6 +13,8 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -45,6 +47,7 @@ fun RoomListDeclineInviteMenu( ) { ModalBottomSheet( onDismissRequest = { eventSink(RoomListEvent.HideDeclineInviteMenu) }, + scrollable = false, ) { RoomListDeclineInviteMenuContent( roomName = menu.roomSummary.name?.toSafeLength( @@ -81,7 +84,8 @@ private fun RoomListDeclineInviteMenuContent( Column( modifier = Modifier .fillMaxWidth() - .padding(all = 16.dp), + .padding(all = 16.dp) + .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, ) { Text( diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/spacefilters/SpaceFiltersView.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/spacefilters/SpaceFiltersView.kt index fb77c74203..1f0d6ff7d9 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/spacefilters/SpaceFiltersView.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/spacefilters/SpaceFiltersView.kt @@ -81,7 +81,8 @@ fun SpaceFiltersView( if (state is SpaceFiltersState.Selecting) { state.eventSink(SpaceFiltersEvent.Selecting.Cancel) } - } + }, + scrollable = false, ) { Box( modifier = Modifier diff --git a/features/invitepeople/impl/src/main/kotlin/io/element/android/features/invitepeople/impl/InvitePeopleView.kt b/features/invitepeople/impl/src/main/kotlin/io/element/android/features/invitepeople/impl/InvitePeopleView.kt index 289ac193d4..b1f139f43c 100644 --- a/features/invitepeople/impl/src/main/kotlin/io/element/android/features/invitepeople/impl/InvitePeopleView.kt +++ b/features/invitepeople/impl/src/main/kotlin/io/element/android/features/invitepeople/impl/InvitePeopleView.kt @@ -262,6 +262,7 @@ private fun InvitePeopleConfirmModal( ModalBottomSheet( onDismissRequest = onDismiss, dragHandle = null, + scrollable = false, ) { IconTitleSubtitleMolecule( title = simplePluralStringResource( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt index ef446e36cf..e10dd2e1bc 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt @@ -156,6 +156,7 @@ fun ActionListView( sheetState = sheetState, onDismissRequest = ::onDismiss, modifier = modifier, + scrollable = false, ) { ActionListViewContent( state = state, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/crypto/sendfailure/resolve/ResolveVerifiedUserSendFailureView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/crypto/sendfailure/resolve/ResolveVerifiedUserSendFailureView.kt index 98e2bba3be..c14dd03f1e 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/crypto/sendfailure/resolve/ResolveVerifiedUserSendFailureView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/crypto/sendfailure/resolve/ResolveVerifiedUserSendFailureView.kt @@ -75,6 +75,7 @@ fun ResolveVerifiedUserSendFailureView( .navigationBarsPadding(), sheetState = sheetState, onDismissRequest = ::dismiss, + scrollable = true, ) { IconTitleSubtitleMolecule( modifier = Modifier.padding(24.dp), diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/AttachmentsBottomSheet.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/AttachmentsBottomSheet.kt index 1fdb61f484..405e2b0be9 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/AttachmentsBottomSheet.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/AttachmentsBottomSheet.kt @@ -13,6 +13,8 @@ import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable @@ -74,7 +76,8 @@ internal fun AttachmentsBottomSheet( sheetState = rememberModalBottomSheetState( skipPartiallyExpanded = true ), - onDismissRequest = { isVisible = false } + onDismissRequest = { isVisible = false }, + scrollable = false, ) { AttachmentSourcePickerMenu( state = state, @@ -97,6 +100,7 @@ private fun AttachmentSourcePickerMenu( modifier = Modifier .navigationBarsPadding() .imePadding() + .verticalScroll(rememberScrollState()) ) { ListItem( modifier = Modifier.clickable { state.eventSink(MessageComposerEvent.PickAttachmentSource.PhotoFromCamera) }, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/customreaction/CustomReactionBottomSheet.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/customreaction/CustomReactionBottomSheet.kt index f42a26cf65..4ac83c520b 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/customreaction/CustomReactionBottomSheet.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/customreaction/CustomReactionBottomSheet.kt @@ -50,7 +50,8 @@ fun CustomReactionBottomSheet( ModalBottomSheet( onDismissRequest = ::onDismiss, sheetState = sheetState, - modifier = modifier + modifier = modifier, + scrollable = false, ) { val presenter = remember { EmojiPickerPresenter( diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt index 03ce564eff..2a902fd692 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/reactionsummary/ReactionSummaryView.kt @@ -90,7 +90,8 @@ fun ReactionSummaryView( if (state.target != null) { ModalBottomSheet( onDismissRequest = ::onDismiss, - modifier = modifier + modifier = modifier, + scrollable = false, ) { ReactionSummaryViewContent(summary = state.target) } diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/receipt/bottomsheet/ReadReceiptBottomSheet.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/receipt/bottomsheet/ReadReceiptBottomSheet.kt index b65e326045..9637298d58 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/receipt/bottomsheet/ReadReceiptBottomSheet.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/receipt/bottomsheet/ReadReceiptBottomSheet.kt @@ -57,7 +57,8 @@ internal fun ReadReceiptBottomSheet( sheetState.hide() state.eventSink(ReadReceiptBottomSheetEvent.Dismiss) } - } + }, + scrollable = false, ) { ReadReceiptBottomSheetContent( state = state, diff --git a/features/rolesandpermissions/impl/src/main/kotlin/io/element/android/features/rolesandpermissions/impl/root/RolesAndPermissionsView.kt b/features/rolesandpermissions/impl/src/main/kotlin/io/element/android/features/rolesandpermissions/impl/root/RolesAndPermissionsView.kt index 269fdee664..2f8dab8029 100644 --- a/features/rolesandpermissions/impl/src/main/kotlin/io/element/android/features/rolesandpermissions/impl/root/RolesAndPermissionsView.kt +++ b/features/rolesandpermissions/impl/src/main/kotlin/io/element/android/features/rolesandpermissions/impl/root/RolesAndPermissionsView.kt @@ -153,6 +153,7 @@ private fun ChangeOwnRoleBottomSheet( .navigationBarsPadding(), sheetState = sheetState, onDismissRequest = ::dismiss, + scrollable = true, ) { Text( modifier = Modifier.padding(14.dp), diff --git a/features/roommembermoderation/impl/src/main/kotlin/io/element/android/features/roommembermoderation/impl/RoomMemberModerationView.kt b/features/roommembermoderation/impl/src/main/kotlin/io/element/android/features/roommembermoderation/impl/RoomMemberModerationView.kt index ac6c5bc4cb..884e421e1f 100644 --- a/features/roommembermoderation/impl/src/main/kotlin/io/element/android/features/roommembermoderation/impl/RoomMemberModerationView.kt +++ b/features/roommembermoderation/impl/src/main/kotlin/io/element/android/features/roommembermoderation/impl/RoomMemberModerationView.kt @@ -17,6 +17,8 @@ import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.layout.systemBarsPadding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable @@ -224,9 +226,12 @@ private fun RoomMemberActionsBottomSheet( onDismiss() } }, + scrollable = false, ) { Column( - modifier = Modifier.padding(vertical = 16.dp) + modifier = Modifier + .padding(vertical = 16.dp) + .verticalScroll(rememberScrollState()) ) { Avatar( avatarData = user.getAvatarData(size = AvatarSize.RoomListManageUser), diff --git a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressView.kt b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressView.kt index e4f8a4faf2..360c59881c 100644 --- a/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressView.kt +++ b/features/startchat/impl/src/main/kotlin/io/element/android/features/startchat/impl/joinbyaddress/JoinRoomByAddressView.kt @@ -13,8 +13,10 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable @@ -52,11 +54,13 @@ fun JoinRoomByAddressView( onDismissRequest = { state.eventSink(JoinRoomByAddressEvent.Dismiss) }, + scrollable = false, ) { Column( modifier = Modifier .fillMaxWidth() - .padding(all = 16.dp), + .padding(all = 16.dp) + .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, ) { RoomAddressField( diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/SimpleModalBottomSheet.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/SimpleModalBottomSheet.kt index 34d119508a..9c3930ac64 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/SimpleModalBottomSheet.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/SimpleModalBottomSheet.kt @@ -14,6 +14,8 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable @@ -38,11 +40,13 @@ fun SimpleModalBottomSheet( onDismissRequest = onDismiss, modifier = modifier, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), + scrollable = false, ) { Column( modifier = Modifier .fillMaxWidth() - .padding(16.dp), + .padding(16.dp) + .verticalScroll(rememberScrollState()), ) { Text( title, diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt index 2c577ec6b7..a7e9672a3a 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt @@ -10,10 +10,13 @@ package io.element.android.libraries.designsystem.theme.components import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.BottomSheetDefaults import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme @@ -42,10 +45,15 @@ import io.element.android.libraries.designsystem.preview.sheetStateForPreview import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch +/** + * For parameter [scrollable], set it to true if the content of the sheet does not already contain a scrollable component, such as a LazyColumn, + * to avoid nested scroll issues. In this case, the content will be wrapped in a Column with verticalScroll. + */ @OptIn(ExperimentalMaterial3Api::class) @Composable fun ModalBottomSheet( onDismissRequest: () -> Unit, + scrollable: Boolean, modifier: Modifier = Modifier, sheetState: SheetState = rememberModalBottomSheetState(), shape: Shape = BottomSheetDefaults.ExpandedShape, @@ -79,8 +87,17 @@ fun ModalBottomSheet( scrimColor = scrimColor, dragHandle = dragHandle, contentWindowInsets = contentWindowInsets, - content = content, - ) + ) { + if (scrollable) { + Column( + modifier = Modifier.verticalScroll(rememberScrollState()), + ) { + content() + } + } else { + content() + } + } } @OptIn(ExperimentalMaterial3Api::class) @@ -112,6 +129,7 @@ private fun ContentToPreview() { ) { ModalBottomSheet( onDismissRequest = {}, + scrollable = false, ) { Text( text = "Sheet Content", diff --git a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/AvatarActionBottomSheet.kt b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/AvatarActionBottomSheet.kt index 4628833bb4..880a7a9df6 100644 --- a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/AvatarActionBottomSheet.kt +++ b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/AvatarActionBottomSheet.kt @@ -67,6 +67,7 @@ fun AvatarActionBottomSheet( }, modifier = modifier, sheetState = sheetState, + scrollable = false, ) { AvatarActionBottomSheetContent( actions = actions, diff --git a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/CreateDmConfirmationBottomSheet.kt b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/CreateDmConfirmationBottomSheet.kt index f63bda378b..d663177ee6 100644 --- a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/CreateDmConfirmationBottomSheet.kt +++ b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/CreateDmConfirmationBottomSheet.kt @@ -14,6 +14,8 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.rememberModalBottomSheetState @@ -74,11 +76,13 @@ fun CreateDmConfirmationBottomSheet( modifier = modifier, onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), + scrollable = false, ) { Column( modifier = Modifier .fillMaxWidth() - .padding(top = 24.dp, bottom = 16.dp, start = 16.dp, end = 16.dp), + .padding(top = 24.dp, bottom = 16.dp, start = 16.dp, end = 16.dp) + .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, ) { if (isUserIdentityUnknown) { @@ -148,9 +152,11 @@ fun CreateDmConfirmationBottomSheet( @PreviewsDayNight @Composable -internal fun CreateDmConfirmationBottomSheetPreview(@PreviewParameter( - CreateDmConfirmationBottomSheetStateProvider::class -) state: CreateDmConfirmationBottomSheetState) = ElementPreview { +internal fun CreateDmConfirmationBottomSheetPreview( + @PreviewParameter( + CreateDmConfirmationBottomSheetStateProvider::class + ) state: CreateDmConfirmationBottomSheetState +) = ElementPreview { CreateDmConfirmationBottomSheet( matrixUser = state.matrixUser, isUserIdentityUnknown = state.isUserIdentityUnknown, @@ -166,7 +172,7 @@ data class CreateDmConfirmationBottomSheetState( class CreateDmConfirmationBottomSheetStateProvider : PreviewParameterProvider { override val values = sequenceOf( - CreateDmConfirmationBottomSheetState(matrixUser = aMatrixUser(), isUserIdentityUnknown = false), - CreateDmConfirmationBottomSheetState(matrixUser = aMatrixUser(), isUserIdentityUnknown = true), - ) + CreateDmConfirmationBottomSheetState(matrixUser = aMatrixUser(), isUserIdentityUnknown = false), + CreateDmConfirmationBottomSheetState(matrixUser = aMatrixUser(), isUserIdentityUnknown = true), + ) } diff --git a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDeleteConfirmationBottomSheet.kt b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDeleteConfirmationBottomSheet.kt index f13e2f1600..0cae7f0262 100644 --- a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDeleteConfirmationBottomSheet.kt +++ b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDeleteConfirmationBottomSheet.kt @@ -59,7 +59,8 @@ fun MediaDeleteConfirmationBottomSheet( ModalBottomSheet( modifier = modifier, onDismissRequest = onDismiss, - sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) + sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), + scrollable = false, ) { Column( modifier = Modifier diff --git a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDetailsBottomSheet.kt b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDetailsBottomSheet.kt index 9ce2dc4a7f..0c73bfd17c 100644 --- a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDetailsBottomSheet.kt +++ b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/details/MediaDetailsBottomSheet.kt @@ -72,6 +72,7 @@ fun MediaDetailsBottomSheet( ModalBottomSheet( modifier = modifier, onDismissRequest = onDismiss, + scrollable = false, ) { Column( modifier = Modifier diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/CaptionWarningBottomSheet.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/CaptionWarningBottomSheet.kt index 23b4fae3a9..bec837664f 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/CaptionWarningBottomSheet.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/CaptionWarningBottomSheet.kt @@ -12,6 +12,8 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -37,11 +39,13 @@ fun CaptionWarningBottomSheet( ModalBottomSheet( modifier = modifier, onDismissRequest = onDismiss, + scrollable = false, ) { Column( modifier = Modifier .fillMaxWidth() - .padding(horizontal = 16.dp), + .padding(horizontal = 16.dp) + .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(16.dp), ) { From 0d078a41ca74a3c1e5d23428523c4a0e1ee9eeb5 Mon Sep 17 00:00:00 2001 From: ElementBot Date: Mon, 27 Apr 2026 08:40:35 +0000 Subject: [PATCH 3/7] Update screenshots --- ...mpl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png | 4 ++-- ...mpl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png | 3 +++ ...mpl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png | 3 +++ ...l.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png | 4 ++-- ...l.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png | 3 +++ ...l.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png | 3 +++ 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png index 70e3f6ae06..686013e622 100644 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22e3dce5359ba6dd21bd1c17e4421b8341c51809843394c95a3d80db7a235309 -size 25774 +oid sha256:2a58c642983f209f2c4bb01ee0239c11edab299f48129800cbd41fe7a9032ad4 +size 26854 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png new file mode 100644 index 0000000000..278dfc4ae5 --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43837ff4703be9631370b56097bd36006bce98d23f17db629742c957ce945e5a +size 42390 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png new file mode 100644 index 0000000000..63a523b4ae --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b3025b589185d8d276bd3a809d8d94700268be1aec951fd02ff37072cef4998 +size 27431 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png index ddea584902..d6392b8c0f 100644 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:671a0a0ce5571cb460fba789b58ec1e38b63b26ba61c1daeb5cccb986eb424b4 -size 24768 +oid sha256:2d7acb04225299d448edf35ad1f420ceafcabc7759a8f7d94ce11eca70781f79 +size 25339 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png new file mode 100644 index 0000000000..bf799e5042 --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56b210d5d8dc06de139735ca34f2b5a4e5e7d0db395dc2dbe7b1c9d479d8858d +size 40405 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png new file mode 100644 index 0000000000..27a4cd57b0 --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ff47c937641549f63948d114510644aad02723a55e752587a1037752a2b3972 +size 25966 From a35236b8b0815dfc9115f6bbf504ad087ae8de29 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 Apr 2026 15:12:23 +0200 Subject: [PATCH 4/7] Rename Preview. --- .../features/home/impl/roomlist/RoomListDeclineInviteMenu.kt | 2 +- ...s.home.impl.roomlist_RoomListDeclineInviteMenu_Day_0_en.png} | 0 ...s.home.impl.roomlist_RoomListDeclineInviteMenu_Day_1_en.png} | 0 ...s.home.impl.roomlist_RoomListDeclineInviteMenu_Day_2_en.png} | 0 ...home.impl.roomlist_RoomListDeclineInviteMenu_Night_0_en.png} | 0 ...home.impl.roomlist_RoomListDeclineInviteMenu_Night_1_en.png} | 0 ...home.impl.roomlist_RoomListDeclineInviteMenu_Night_2_en.png} | 0 7 files changed, 1 insertion(+), 1 deletion(-) rename tests/uitests/src/test/snapshots/images/{features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png => features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_0_en.png} (100%) rename tests/uitests/src/test/snapshots/images/{features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png => features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_1_en.png} (100%) rename tests/uitests/src/test/snapshots/images/{features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png => features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_2_en.png} (100%) rename tests/uitests/src/test/snapshots/images/{features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png => features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_0_en.png} (100%) rename tests/uitests/src/test/snapshots/images/{features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png => features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_1_en.png} (100%) rename tests/uitests/src/test/snapshots/images/{features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png => features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_2_en.png} (100%) diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt index 74462ec10c..0a7a29ebc2 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListDeclineInviteMenu.kt @@ -125,7 +125,7 @@ private fun RoomListDeclineInviteMenuContent( @PreviewsDayNight @Composable -internal fun RoomListDeclineInviteMenuContentPreview( +internal fun RoomListDeclineInviteMenuPreview( @PreviewParameter(RoomListStateDeclineInviteMenuShownProvider::class) menu: RoomListState.DeclineInviteMenu.Shown, ) = ElementPreview { RoomListDeclineInviteMenu( diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_0_en.png similarity index 100% rename from tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_0_en.png rename to tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_0_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_1_en.png similarity index 100% rename from tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_1_en.png rename to tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_1_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_2_en.png similarity index 100% rename from tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Day_2_en.png rename to tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Day_2_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_0_en.png similarity index 100% rename from tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_0_en.png rename to tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_0_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_1_en.png similarity index 100% rename from tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_1_en.png rename to tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_1_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_2_en.png similarity index 100% rename from tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenuContent_Night_2_en.png rename to tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListDeclineInviteMenu_Night_2_en.png From e289ec2af7cb106b0c9b58c0b54b5098e3da97e3 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 Apr 2026 15:15:23 +0200 Subject: [PATCH 5/7] Preview the whole bottom sheet. --- .../home/impl/roomlist/RoomListContextMenu.kt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt index 569787c383..66982961fd 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/roomlist/RoomListContextMenu.kt @@ -217,23 +217,16 @@ private fun RoomListModalBottomSheetContent( } } -// TODO This component should be seen in [RoomListView] @Preview but it doesn't show up. -// see: https://issuetracker.google.com/issues/283843380 -// Remove this preview when the issue is fixed. @PreviewsDayNight @Composable -internal fun RoomListModalBottomSheetContentPreview( +internal fun RoomListContextMenuPreview( @PreviewParameter(RoomListStateContextMenuShownProvider::class) contextMenu: RoomListState.ContextMenu.Shown ) = ElementPreview { - RoomListModalBottomSheetContent( + RoomListContextMenu( contextMenu = contextMenu, canReportRoom = true, - onRoomMarkReadClick = {}, - onRoomMarkUnreadClick = {}, onRoomSettingsClick = {}, - onLeaveRoomClick = {}, - onFavoriteChange = {}, - onClearCacheRoomClick = {}, onReportRoomClick = {}, + eventSink = {}, ) } From dca2dba938f9fe451702d487a35afb644af0ac60 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 Apr 2026 15:16:42 +0200 Subject: [PATCH 6/7] Remove obsolete comment. --- .../libraries/designsystem/theme/components/ModalBottomSheet.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt index a7e9672a3a..689cba727f 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ModalBottomSheet.kt @@ -108,13 +108,11 @@ fun SheetState.hide(coroutineScope: CoroutineScope, then: suspend () -> Unit) { } } -// This preview and its screenshots are blank, see: https://issuetracker.google.com/issues/283843380 @Preview(group = PreviewGroup.BottomSheets) @Composable internal fun ModalBottomSheetLightPreview() = ElementPreviewLight { ContentToPreview() } -// This preview and its screenshots are blank, see: https://issuetracker.google.com/issues/283843380 @Preview(group = PreviewGroup.BottomSheets) @Composable internal fun ModalBottomSheetDarkPreview() = From 21cae089ae21992be18fb37aa98152edf20c6d2f Mon Sep 17 00:00:00 2001 From: ElementBot Date: Mon, 27 Apr 2026 13:39:42 +0000 Subject: [PATCH 7/7] Update screenshots --- ...eatures.home.impl.roomlist_RoomListContextMenu_Day_0_en.png | 3 +++ ...eatures.home.impl.roomlist_RoomListContextMenu_Day_1_en.png | 3 +++ ...eatures.home.impl.roomlist_RoomListContextMenu_Day_2_en.png | 3 +++ ...tures.home.impl.roomlist_RoomListContextMenu_Night_0_en.png | 3 +++ ...tures.home.impl.roomlist_RoomListContextMenu_Night_1_en.png | 3 +++ ...tures.home.impl.roomlist_RoomListContextMenu_Night_2_en.png | 3 +++ ....impl.roomlist_RoomListModalBottomSheetContent_Day_0_en.png | 3 --- ....impl.roomlist_RoomListModalBottomSheetContent_Day_1_en.png | 3 --- ....impl.roomlist_RoomListModalBottomSheetContent_Day_2_en.png | 3 --- ...mpl.roomlist_RoomListModalBottomSheetContent_Night_0_en.png | 3 --- ...mpl.roomlist_RoomListModalBottomSheetContent_Night_1_en.png | 3 --- ...mpl.roomlist_RoomListModalBottomSheetContent_Night_2_en.png | 3 --- 12 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_0_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_1_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_2_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_0_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_1_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_2_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_1_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_2_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_1_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_2_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_0_en.png new file mode 100644 index 0000000000..6b4037b3eb --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_0_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c755a7dcfc2c9f48d449e570a3f1af1cde299fd90ddd4478e9a4c315cf03128 +size 23810 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_1_en.png new file mode 100644 index 0000000000..e64ae4c3cf --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_1_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efa5408c3af0fcd39659b8d30b21ace43be46d2876815ad592f802a7887b5eb9 +size 23678 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_2_en.png new file mode 100644 index 0000000000..82b04fc045 --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Day_2_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fc512e71e168473e0e976be3e3e6cd24b455273257ad0adf970fc2641da43bb +size 25679 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_0_en.png new file mode 100644 index 0000000000..f52d785548 --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_0_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de71af50bba66a285b5ef44e1a4fe76ce6dc2e094c4c09ddf701deb9a5db898d +size 22025 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_1_en.png new file mode 100644 index 0000000000..eef2177c3b --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_1_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88b3583d55c6855027f13a152a6fc414f6b9e11d65e5b5403463b84fafe38c3f +size 21891 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_2_en.png new file mode 100644 index 0000000000..87d3f56720 --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListContextMenu_Night_2_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e64367832735139b68269a8c679b9c6f2b929b906124a0ee93735cbdd9202d6d +size 23826 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_0_en.png deleted file mode 100644 index 9b17990dbe..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a81e2f9d2c3834004b49b925025478b886c065a12dc850f1c42733e457630b97 -size 22442 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_1_en.png deleted file mode 100644 index 5b45fb30de..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d3348885402696e4b8005740a452384223f60a64c524c32713cfbd9b3041e494 -size 22297 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_2_en.png deleted file mode 100644 index 1ec1abe309..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Day_2_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a1a54d3171418082d8bdf442bb34c6b149e2707963f88dd7ea7cbff401534fc0 -size 23856 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_0_en.png deleted file mode 100644 index e5a42fb07f..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3ea756319eeb2d9ab6ad2425498a7a9902acada24c3ab359f880b5934f2511e5 -size 21384 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_1_en.png deleted file mode 100644 index 2388eb323d..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c75bbb8425fa4b01f9d0d9398d93785f2a149f4abb820dadbfadf17bf4a6673e -size 21077 diff --git a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_2_en.png b/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_2_en.png deleted file mode 100644 index 356ee32526..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.home.impl.roomlist_RoomListModalBottomSheetContent_Night_2_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:99defb3eb8530142a74c083d4f4ec2e592d465b3d2cf869e1710031ad6a805c9 -size 23136