From 6b9e6516479e40fb6cfb1cf9e9ea561b2091e601 Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 30 Oct 2024 15:17:02 +0200 Subject: [PATCH] feat: Add Accessibility strings to YourProfile [WPB-9826] (#3568) --- .../create/code/CreateAccountCodeScreen.kt | 4 ++- .../CreatePersonalAccountOverviewScreen.kt | 12 ++++++-- .../ui/authentication/devices/DeviceItem.kt | 12 +++----- .../ui/authentication/login/LoginScreen.kt | 4 ++- .../login/email/LoginEmailScreen.kt | 5 +++- .../login/sso/LoginSSOScreen.kt | 1 + .../authentication/welcome/WelcomeScreen.kt | 16 +++++++---- .../wire/android/ui/common/AppExtensions.kt | 1 - .../android/ui/common/UserProfileAvatar.kt | 1 - .../wire/android/ui/common/WireDropDown.kt | 28 +++++++++++-------- .../android/ui/common/WireLabelledCheckbox.kt | 4 +-- .../bottomsheet/RichMenuBottomSheetItem.kt | 2 -- .../GroupConversationNameComponent.kt | 3 -- .../common/textfield/WirePasswordTextField.kt | 2 ++ .../options/GroupConversationOptionsItem.kt | 2 -- .../conversations/messages/QuotedMessage.kt | 5 ++-- .../home/conversations/model/MessageTypes.kt | 2 -- .../location/LocationMessageType.kt | 2 -- .../search/SearchUsersAndServicesScreen.kt | 3 +- .../SearchConversationMessagesEmptyScreen.kt | 2 +- .../conversationslist/common/FolderHeader.kt | 5 +--- .../home/conversationslist/common/RowItem.kt | 2 -- .../android/ui/home/settings/SettingsItem.kt | 2 -- .../common/LearnMoreAboutLegalHoldButton.kt | 3 +- .../userprofile/avatarpicker/AvatarPicker.kt | 2 ++ .../ui/userprofile/common/UserProfileInfo.kt | 19 ++++++++++--- .../userprofile/self/SelfUserProfileScreen.kt | 17 +++++++---- app/src/main/res/values/strings.xml | 24 ++++++++++++---- .../com/wire/android/ui/common/Extensions.kt | 21 ++------------ .../com/wire/android/ui/common/WireDialog.kt | 7 ++++- .../common/bottomsheet/MenuBottomSheetItem.kt | 2 -- .../topappbar/WireCenterAlignedTopAppBar.kt | 22 +++++++-------- .../ui-common/src/main/res/values/strings.xml | 2 +- 33 files changed, 129 insertions(+), 110 deletions(-) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeScreen.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeScreen.kt index 7e1ba6d68d4..318ae837b0b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/create/code/CreateAccountCodeScreen.kt @@ -60,6 +60,7 @@ import com.wire.android.ui.common.progress.WireCircularProgressIndicator import com.wire.android.ui.common.scaffold.WireScaffold import com.wire.android.ui.common.textfield.CodeTextField import com.wire.android.ui.common.textfield.WireTextFieldState +import com.wire.android.ui.common.topappbar.NavigationIconType import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar import com.wire.android.ui.destinations.CreateAccountSummaryScreenDestination import com.wire.android.ui.destinations.RemoveDeviceScreenDestination @@ -143,7 +144,8 @@ private fun CodeContent( style = MaterialTheme.wireTypography.body01 ) } - } + }, + navigationIconType = NavigationIconType.Back(R.string.content_description_login_back_btn) ) }) { internalPadding -> Column( diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/create/overview/CreatePersonalAccountOverviewScreen.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/create/overview/CreatePersonalAccountOverviewScreen.kt index cb8cde25dea..ba76da0c892 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/create/overview/CreatePersonalAccountOverviewScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/create/overview/CreatePersonalAccountOverviewScreen.kt @@ -26,7 +26,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme -import com.wire.android.ui.common.scaffold.WireScaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember @@ -36,6 +35,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.tooling.preview.Preview @@ -51,6 +51,8 @@ import com.wire.android.ui.authentication.create.common.CreatePersonalAccountNav import com.wire.android.ui.authentication.create.common.CreateTeamAccountNavGraph import com.wire.android.ui.common.button.WirePrimaryButton import com.wire.android.ui.common.dimensions +import com.wire.android.ui.common.scaffold.WireScaffold +import com.wire.android.ui.common.topappbar.NavigationIconType import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar import com.wire.android.ui.destinations.CreateAccountEmailScreenDestination import com.wire.android.ui.theme.WireTheme @@ -126,6 +128,7 @@ private fun OverviewContent( elevation = dimensions().spacing0x, title = overviewParams.title, onNavigationPressed = onBackPressed, + navigationIconType = NavigationIconType.Back(R.string.content_description_login_back_btn), subtitleContent = { if (serverConfig.isOnPremises) { ServerTitle( @@ -149,6 +152,7 @@ private fun OverviewContent( horizontal = MaterialTheme.wireDimensions.spacing64x, vertical = MaterialTheme.wireDimensions.spacing32x ) + .clearAndSetSemantics {} ) OverviewTexts( modifier = Modifier.padding(horizontal = MaterialTheme.wireDimensions.spacing24x), @@ -182,13 +186,14 @@ private fun OverviewTexts( modifier = Modifier .fillMaxWidth() .padding(bottom = MaterialTheme.wireDimensions.spacing8x) + .clearAndSetSemantics {} ) } Text( text = overviewParams.contentText, style = MaterialTheme.wireTypography.body02, textAlign = TextAlign.Center, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth().clearAndSetSemantics {} ) Text( text = overviewParams.learnMoreText, @@ -201,7 +206,8 @@ private fun OverviewTexts( .clickable( interactionSource = remember { MutableInteractionSource() }, indication = null, - onClick = onLearnMoreClick + onClick = onLearnMoreClick, + onClickLabel = stringResource(R.string.content_description_open_link_label) ) ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt index afccc77eb5a..7eb4d18c742 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/devices/DeviceItem.kt @@ -42,8 +42,6 @@ import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.semantics.onClick -import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import com.wire.android.BuildConfig @@ -103,19 +101,17 @@ private fun DeviceItemContent( shouldShowE2EIInfo: Boolean, modifier: Modifier = Modifier, ) { - val openDetailsDescription = stringResource(id = R.string.content_description_user_profile_open_device_btn) - Row( verticalAlignment = Alignment.Top, modifier = modifier - .clickable(enabled = isWholeItemClickable) { + .clickable( + enabled = isWholeItemClickable, + onClickLabel = stringResource(id = R.string.content_description_user_profile_open_device_btn) + ) { if (isWholeItemClickable) { onClickAction?.invoke(device) } } - .semantics { - if (isWholeItemClickable) onClick(openDetailsDescription) { false } - } ) { Row( modifier = Modifier diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginScreen.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginScreen.kt index 791a58e8727..3c5e63e03c8 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginScreen.kt @@ -70,6 +70,7 @@ import com.wire.android.ui.common.dialogs.FeatureDisabledWithProxyDialogContent import com.wire.android.ui.common.dialogs.FeatureDisabledWithProxyDialogState import com.wire.android.ui.common.rememberTopBarElevationState import com.wire.android.ui.common.scaffold.WireScaffold +import com.wire.android.ui.common.topappbar.NavigationIconType import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar import com.wire.android.ui.common.visbility.rememberVisibilityState import com.wire.android.ui.destinations.E2EIEnrollmentScreenDestination @@ -174,7 +175,8 @@ private fun MainLoginContent( ) } }, - onNavigationPressed = onBackPressed + onNavigationPressed = onBackPressed, + navigationIconType = NavigationIconType.Back(R.string.content_description_login_back_btn) ) { WireTabRow( tabs = LoginTabItem.values().toList(), diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/login/email/LoginEmailScreen.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/login/email/LoginEmailScreen.kt index 5f1351dfc9b..f15601748b7 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/login/email/LoginEmailScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/login/email/LoginEmailScreen.kt @@ -239,6 +239,7 @@ private fun UserIdentifierInput( error != null -> WireTextFieldState.Error(error) else -> WireTextFieldState.Default }, + semanticDescription = stringResource(R.string.content_description_login_email_field), keyboardOptions = KeyboardOptions.DefaultEmailNext, modifier = modifier.testTag("emailField"), testTag = "userIdentifierInput" @@ -252,6 +253,7 @@ private fun PasswordInput(passwordState: TextFieldState, modifier: Modifier = Mo textState = passwordState, keyboardOptions = KeyboardOptions.DefaultPassword.copy(imeAction = ImeAction.Done), onKeyboardAction = { keyboardController?.hide() }, + semanticDescription = stringResource(R.string.content_description_login_password_field), modifier = modifier.testTag("passwordField"), autoFill = true, testTag = "PasswordInput" @@ -273,7 +275,8 @@ private fun ForgotPasswordLabel(forgotPasswordUrl: String, modifier: Modifier = .clickable( interactionSource = remember { MutableInteractionSource() }, indication = null, - onClick = { openForgotPasswordPage(context, forgotPasswordUrl) } + onClick = { openForgotPasswordPage(context, forgotPasswordUrl) }, + onClickLabel = stringResource(R.string.content_description_open_link_label) ) .testTag("Forgot password?") ) diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/login/sso/LoginSSOScreen.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/login/sso/LoginSSOScreen.kt index ddc8ece1858..9a1116d3604 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/login/sso/LoginSSOScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/login/sso/LoginSSOScreen.kt @@ -159,6 +159,7 @@ private fun SSOCodeInput( WireTextField( textState = ssoCodeState, labelText = stringResource(R.string.login_sso_code_label), + semanticDescription = stringResource(R.string.content_description_login_sso_code_field), state = if (error != null) WireTextFieldState.Error(error) else WireTextFieldState.Default, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text, imeAction = ImeAction.Next), modifier = modifier.testTag("ssoCodeField") diff --git a/app/src/main/kotlin/com/wire/android/ui/authentication/welcome/WelcomeScreen.kt b/app/src/main/kotlin/com/wire/android/ui/authentication/welcome/WelcomeScreen.kt index 05b8b90b963..55cae81e859 100644 --- a/app/src/main/kotlin/com/wire/android/ui/authentication/welcome/WelcomeScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/authentication/welcome/WelcomeScreen.kt @@ -39,7 +39,6 @@ import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme -import com.wire.android.ui.common.scaffold.WireScaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider @@ -59,6 +58,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringArrayResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.semantics.clearAndSetSemantics import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.compose.ui.text.style.TextAlign @@ -81,6 +81,7 @@ import com.wire.android.ui.common.dialogs.FeatureDisabledWithProxyDialogState import com.wire.android.ui.common.dialogs.MaxAccountsReachedDialog import com.wire.android.ui.common.dialogs.MaxAccountsReachedDialogState import com.wire.android.ui.common.dimensions +import com.wire.android.ui.common.scaffold.WireScaffold import com.wire.android.ui.common.topappbar.NavigationIconType import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar import com.wire.android.ui.common.visbility.rememberVisibilityState @@ -135,7 +136,7 @@ private fun WelcomeContent( WireCenterAlignedTopAppBar( elevation = dimensions().spacing0x, title = "", - navigationIconType = NavigationIconType.Close(), + navigationIconType = NavigationIconType.Close(R.string.content_description_welcome_screen_close_btn), onNavigationPressed = navigateBack ) } else { @@ -157,7 +158,7 @@ private fun WelcomeContent( Icon( imageVector = ImageVector.vectorResource(id = R.drawable.ic_wire_logo), tint = MaterialTheme.colorScheme.onBackground, - contentDescription = stringResource(id = R.string.content_description_welcome_wire_logo) + contentDescription = null ) if (state.isOnPremises) { @@ -297,7 +298,7 @@ private fun WelcomeCarouselItem(pageIconResId: Int, pageText: String) { ) { Image( painter = painterResource(id = pageIconResId), - contentDescription = "", + contentDescription = null, contentScale = ContentScale.Inside, modifier = Modifier .weight(1f, true) @@ -311,7 +312,9 @@ private fun WelcomeCarouselItem(pageIconResId: Int, pageText: String) { style = MaterialTheme.wireTypography.title01, overflow = TextOverflow.Ellipsis, textAlign = TextAlign.Center, - modifier = Modifier.padding(horizontal = MaterialTheme.wireDimensions.welcomeTextHorizontalPadding) + modifier = Modifier + .padding(horizontal = MaterialTheme.wireDimensions.welcomeTextHorizontalPadding) + .clearAndSetSemantics {} ) } } @@ -358,7 +361,8 @@ private fun WelcomeFooter(modifier: Modifier, onPrivateAccountClick: () -> Unit) .clickable( interactionSource = remember { MutableInteractionSource() }, indication = null, - onClick = onPrivateAccountClick + onClick = onPrivateAccountClick, + onClickLabel = stringResource(R.string.content_description_open_link_label) ) ) diff --git a/app/src/main/kotlin/com/wire/android/ui/common/AppExtensions.kt b/app/src/main/kotlin/com/wire/android/ui/common/AppExtensions.kt index a74f1028eaa..02599e19800 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/AppExtensions.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/AppExtensions.kt @@ -69,7 +69,6 @@ fun Modifier.selectableBackground(isSelected: Boolean, onClick: () -> Unit): Mod return this .clickable(onItemClick) - .clickableDescriptions(onItemClick) .semantics { stateDescription = if (isSelected) selectedDescription else "" } } diff --git a/app/src/main/kotlin/com/wire/android/ui/common/UserProfileAvatar.kt b/app/src/main/kotlin/com/wire/android/ui/common/UserProfileAvatar.kt index cd8dcf25d38..abe895cabba 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/UserProfileAvatar.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/UserProfileAvatar.kt @@ -143,7 +143,6 @@ fun UserProfileAvatar( .wrapContentSize() .clip(CircleShape) .clickable(clickable) - .clickableDescriptions(clickable) ) { var userStatusIndicatorParams by remember { mutableStateOf(Size.Zero to Offset.Zero) } Box( diff --git a/app/src/main/kotlin/com/wire/android/ui/common/WireDropDown.kt b/app/src/main/kotlin/com/wire/android/ui/common/WireDropDown.kt index c4ed6982e9a..f03cb18661c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/WireDropDown.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/WireDropDown.kt @@ -32,10 +32,10 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.DropdownMenuItem import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ExpandMore import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -55,6 +55,8 @@ import androidx.compose.ui.layout.onGloballyPositioned import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.onClick +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.DpOffset import androidx.compose.ui.unit.dp @@ -72,13 +74,14 @@ import com.wire.kalium.logic.data.conversation.ConversationOptions @Composable internal fun WireDropDown( items: List, + label: String?, + modifier: Modifier = Modifier, defaultItemIndex: Int = -1, selectedItemIndex: Int = defaultItemIndex, - label: String?, - modifier: Modifier, autoUpdateSelection: Boolean = true, showDefaultTextIndicator: Boolean = true, leadingCompose: @Composable ((index: Int) -> Unit)? = null, + onChangeClickDescription: String = stringResource(R.string.content_description_change_it_label), onSelected: (selectedIndex: Int) -> Unit ) { var expanded by remember { mutableStateOf(false) } @@ -114,7 +117,7 @@ internal fun WireDropDown( // the DropDown the same width selectionFieldWidth = coordinates.size.toSize() } - .clickable { expanded = true }, + .clickable(onClickLabel = onChangeClickDescription) { expanded = true }, leadingCompose = leadingCompose, selectedIndex = selectedIndex, text = selectionText, @@ -177,7 +180,7 @@ private fun MenuPopUp( ) { SelectionField( - Modifier.clickable { hidePopUp() }, + Modifier.clickable(onClickLabel = stringResource(R.string.content_description_close_dropdown)) { hidePopUp() }, leadingCompose, selectedIndex, selectionText, @@ -236,7 +239,7 @@ private fun SelectionField( ) Icon( imageVector = Icons.Filled.ExpandMore, - contentDescription = stringResource(R.string.change), + contentDescription = null, tint = MaterialTheme.wireColorScheme.secondaryText, modifier = Modifier .padding(top = 4.dp) @@ -256,8 +259,9 @@ private fun DropdownItem( leadingCompose: (@Composable () -> Unit)?, isSelected: Boolean, onClick: () -> Unit -) = - DropdownMenuItem( +) { + val selectLabel = stringResource(R.string.content_description_select_label) + return DropdownMenuItem( text = { Text( text = text, @@ -270,16 +274,18 @@ private fun DropdownItem( leadingIcon = leadingCompose, trailingIcon = { if (isSelected) { - WireCheckIcon() + WireCheckIcon(R.string.content_description_selected_label) } }, onClick = onClick, modifier = Modifier + .semantics { onClick(selectLabel) { false } } .background( color = if (isSelected) MaterialTheme.wireColorScheme.secondaryButtonSelected - else MaterialTheme.wireColorScheme.tertiaryButtonEnabled + else MaterialTheme.wireColorScheme.tertiaryButtonEnabled ) ) +} @Composable private fun RowScope.LeadingIcon(convent: @Composable () -> Unit) { @@ -299,7 +305,7 @@ fun PreviewWireDropdownPreviewWithLabel() { items = ConversationOptions.Protocol.values().map { it.name }, defaultItemIndex = 0, selectedItemIndex = 0, - "Protocol", + label = "Protocol", modifier = Modifier ) {} } diff --git a/app/src/main/kotlin/com/wire/android/ui/common/WireLabelledCheckbox.kt b/app/src/main/kotlin/com/wire/android/ui/common/WireLabelledCheckbox.kt index baa842a7152..2bad16190c6 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/WireLabelledCheckbox.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/WireLabelledCheckbox.kt @@ -42,12 +42,12 @@ fun WireLabelledCheckbox( label: String, checked: Boolean, onCheckClicked: ((Boolean) -> Unit), + modifier: Modifier = Modifier, maxLine: Int = Int.MAX_VALUE, overflow: TextOverflow = TextOverflow.Visible, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, contentPadding: PaddingValues = PaddingValues(dimensions().spacing0x), - checkboxEnabled: Boolean = true, - modifier: Modifier = Modifier + checkboxEnabled: Boolean = true ) { Row( verticalAlignment = Alignment.CenterVertically, diff --git a/app/src/main/kotlin/com/wire/android/ui/common/bottomsheet/RichMenuBottomSheetItem.kt b/app/src/main/kotlin/com/wire/android/ui/common/bottomsheet/RichMenuBottomSheetItem.kt index 9e78f99f669..11f79bd49b8 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/bottomsheet/RichMenuBottomSheetItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/bottomsheet/RichMenuBottomSheetItem.kt @@ -39,7 +39,6 @@ import com.wire.android.R import com.wire.android.model.Clickable import com.wire.android.ui.common.WireCheckIcon import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.common.dimensions import com.wire.android.ui.theme.DEFAULT_WEIGHT import com.wire.android.ui.theme.wireColorScheme @@ -65,7 +64,6 @@ fun SelectableMenuBottomSheetItem( .defaultMinSize(minHeight = dimensions().spacing48x) .let { if (isSelectedItem(state)) it.background(MaterialTheme.wireColorScheme.secondaryButtonSelected) else it } .clickable(onItemClick) - .clickableDescriptions(onItemClick) .padding(vertical = dimensions().spacing12x, horizontal = dimensions().spacing16x) ) { icon() diff --git a/app/src/main/kotlin/com/wire/android/ui/common/groupname/GroupConversationNameComponent.kt b/app/src/main/kotlin/com/wire/android/ui/common/groupname/GroupConversationNameComponent.kt index ce5d77f0d80..5694b03a6c4 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/groupname/GroupConversationNameComponent.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/groupname/GroupConversationNameComponent.kt @@ -74,13 +74,10 @@ fun GroupNameScreen( WireScaffold( modifier = modifier, topBar = { - val titleContentDescription = - if (mode == CREATION) stringResource(id = R.string.content_description_new_conversation_name_heading) else null WireCenterAlignedTopAppBar( elevation = scrollState.rememberTopBarElevationState().value, onNavigationPressed = onBackPressed, title = stringResource(id = if (mode == CREATION) R.string.new_group_title else R.string.group_name_title), - titleContentDescription = titleContentDescription, navigationIconType = NavigationIconType.Back(R.string.content_description_new_conversation_name_back_btn) ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/common/textfield/WirePasswordTextField.kt b/app/src/main/kotlin/com/wire/android/ui/common/textfield/WirePasswordTextField.kt index b0c90b192b5..87626e8f3aa 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/textfield/WirePasswordTextField.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/textfield/WirePasswordTextField.kt @@ -74,6 +74,7 @@ fun WirePasswordTextField( labelText: String? = stringResource(R.string.login_password_label), labelMandatoryIcon: Boolean = false, descriptionText: String? = null, + semanticDescription: String? = null, state: WireTextFieldState = WireTextFieldState.Default, autoFill: Boolean = false, inputTransformation: InputTransformation = InputTransformation.maxLength(8000), @@ -97,6 +98,7 @@ fun WirePasswordTextField( labelText = labelText, labelMandatoryIcon = labelMandatoryIcon, descriptionText = descriptionText, + semanticDescription = semanticDescription, state = state, interactionSource = interactionSource, placeholderTextStyle = placeholderTextStyle, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptionsItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptionsItem.kt index 7a39282235a..d2a0349a6e5 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptionsItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/details/options/GroupConversationOptionsItem.kt @@ -44,7 +44,6 @@ import com.wire.android.model.Clickable import com.wire.android.ui.common.ArrowRightIcon import com.wire.android.ui.common.button.WireSecondaryButton import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.home.settings.SettingsOptionSwitch import com.wire.android.ui.home.settings.SwitchState import com.wire.android.ui.theme.wireColorScheme @@ -73,7 +72,6 @@ fun GroupConversationOptionsItem( verticalAlignment = Alignment.CenterVertically, modifier = modifier .clickable(clickable) - .clickableDescriptions(clickable) .semantics { contentDescription?.let { this.contentDescription = contentDescription } } .padding( top = MaterialTheme.wireDimensions.spacing12x, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/QuotedMessage.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/QuotedMessage.kt index dd6d96f1358..308b57ea5c2 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/QuotedMessage.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/messages/QuotedMessage.kt @@ -57,7 +57,6 @@ import com.wire.android.model.Clickable import com.wire.android.model.ImageAsset import com.wire.android.ui.common.StatusBox import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.common.colorsScheme import com.wire.android.ui.common.dimensions import com.wire.android.ui.common.typography @@ -227,7 +226,7 @@ private fun QuotedMessageContent( .fillMaxWidth() .height(IntrinsicSize.Min) .let { - if (clickable != null) it.clickable(clickable).clickableDescriptions(clickable) else it + if (clickable != null) it.clickable(clickable) else it } ) { Box(modifier = Modifier.padding(start = dimensions().spacing4x)) { @@ -450,7 +449,7 @@ private fun AutosizeContainer( .fillMaxWidth() .padding(dimensions().spacing8x) .let { - if (clickable != null) it.clickable(clickable).clickableDescriptions(clickable) else it + if (clickable != null) it.clickable(clickable) else it } ) { val (leftSide, rightSide) = createRefs() diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt index 4e5baac9e9f..e7ea4861962 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt @@ -44,7 +44,6 @@ import com.wire.android.model.ImageAsset import com.wire.android.ui.common.button.WireButtonState import com.wire.android.ui.common.button.WireSecondaryButton import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.common.dimensions import com.wire.android.ui.home.conversations.CompositeMessageViewModel import com.wire.android.ui.home.conversations.CompositeMessageViewModelImpl @@ -248,7 +247,6 @@ fun MediaAssetImage( ) .wrapContentSize() .clickable(onImageClick) - .clickableDescriptions(onImageClick) ) { when { // Trying to upload the asset diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/location/LocationMessageType.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/location/LocationMessageType.kt index c58738d15c0..cc0a672699c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/location/LocationMessageType.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/location/LocationMessageType.kt @@ -46,7 +46,6 @@ import androidx.compose.ui.unit.sp import com.wire.android.R import com.wire.android.model.Clickable import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.common.dimensions import com.wire.android.ui.theme.wireColorScheme import com.wire.android.ui.theme.wireDimensions @@ -62,7 +61,6 @@ fun LocationMessageContent( Column( modifier = Modifier .clickable(onLocationClick) - .clickableDescriptions(onLocationClick) .padding(top = dimensions().spacing4x) .clip(shape = RoundedCornerShape(dimensions().messageAssetBorderRadius)) .border( diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchUsersAndServicesScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchUsersAndServicesScreen.kt index bcfd4e52bdd..4223f71d9b7 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchUsersAndServicesScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchUsersAndServicesScreen.kt @@ -120,8 +120,7 @@ fun SearchUsersAndServicesScreen( SearchPeopleScreenType.NEW_CONVERSATION -> NavigationIconType.Close() SearchPeopleScreenType.NEW_GROUP_CONVERSATION -> NavigationIconType.Back() }, - onNavigationPressed = onClose, - titleContentDescription = stringResource(id = R.string.content_description_add_participants_heading) + onNavigationPressed = onClose ) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/messages/SearchConversationMessagesEmptyScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/messages/SearchConversationMessagesEmptyScreen.kt index 3e784db3b6f..357af132714 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/messages/SearchConversationMessagesEmptyScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/search/messages/SearchConversationMessagesEmptyScreen.kt @@ -66,7 +66,7 @@ fun SearchConversationMessagesEmptyScreen(modifier: Modifier = Modifier) { textDecoration = TextDecoration.Underline, color = MaterialTheme.colorScheme.onBackground ), - modifier = Modifier.clickable { + modifier = Modifier.clickable(onClickLabel = stringResource(R.string.content_description_open_link_label)) { CustomTabsHelper.launchUrl( context, searchUrl diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/FolderHeader.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/FolderHeader.kt index a6e7a51de9a..e422ee1b40b 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/FolderHeader.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/FolderHeader.kt @@ -35,8 +35,6 @@ import androidx.compose.ui.draw.rotate import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.semantics.onClick -import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import com.wire.android.R @@ -74,8 +72,7 @@ fun CollapsingFolderHeader( Row( verticalAlignment = Alignment.CenterVertically, modifier = modifier - .semantics { onClick(expandDescription) { false } } - .clickable { onClicked(!expanded) } + .clickable(onClickLabel = expandDescription) { onClicked(!expanded) } .padding(horizontal = dimensions().spacing8x, vertical = dimensions().spacing16x) ) { Icon( diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/RowItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/RowItem.kt index 626ef5f8ca0..f5ad8749c5d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/RowItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversationslist/common/RowItem.kt @@ -30,7 +30,6 @@ import androidx.compose.ui.Modifier import com.wire.android.model.Clickable import com.wire.android.ui.common.SurfaceBackgroundWrapper import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.theme.wireDimensions @Composable @@ -47,7 +46,6 @@ fun RowItem( verticalAlignment = Alignment.CenterVertically, modifier = Modifier .clickable(clickable) - .clickableDescriptions(clickable) .then( modifier .defaultMinSize(minHeight = MaterialTheme.wireDimensions.conversationItemRowHeight) diff --git a/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsItem.kt b/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsItem.kt index 2ba3eb27ca5..2aaead37c90 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsItem.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsItem.kt @@ -40,7 +40,6 @@ import com.wire.android.navigation.TermsOfUseScreenDestination import com.wire.android.navigation.WireWebsiteScreenDestination import com.wire.android.ui.common.RowItemTemplate import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.common.dimensions import com.wire.android.ui.destinations.AboutThisAppScreenDestination import com.wire.android.ui.destinations.AppSettingsScreenDestination @@ -96,7 +95,6 @@ fun SettingsItem( .defaultMinSize(dimensions().wireIconButtonSize) .padding(end = dimensions().spacing8x) .clickable(onIconPressed) - .clickableDescriptions(onIconPressed) ) } ?: Icons.Filled.ChevronRight }, diff --git a/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt index 866e9891fae..ea9bf08e237 100644 --- a/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt +++ b/app/src/main/kotlin/com/wire/android/ui/legalhold/dialog/common/LearnMoreAboutLegalHoldButton.kt @@ -46,7 +46,8 @@ fun LearnMoreAboutLegalHoldButton(modifier: Modifier = Modifier) { modifier = modifier.clickable( interactionSource = remember { MutableInteractionSource() }, indication = null, - onClick = remember { { CustomTabsHelper.launchUrl(context, learnMoreUrl) } } + onClick = remember { { CustomTabsHelper.launchUrl(context, learnMoreUrl) } }, + onClickLabel = stringResource(R.string.content_description_open_link_label) ) ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/userprofile/avatarpicker/AvatarPicker.kt b/app/src/main/kotlin/com/wire/android/ui/userprofile/avatarpicker/AvatarPicker.kt index ea61fbeb0d9..9622bafcbeb 100644 --- a/app/src/main/kotlin/com/wire/android/ui/userprofile/avatarpicker/AvatarPicker.kt +++ b/app/src/main/kotlin/com/wire/android/ui/userprofile/avatarpicker/AvatarPicker.kt @@ -59,6 +59,7 @@ import com.wire.android.ui.common.dialogs.PermissionPermanentlyDeniedDialog import com.wire.android.ui.common.dimensions import com.wire.android.ui.common.imagepreview.BulletHoleImagePreview import com.wire.android.ui.common.scaffold.WireScaffold +import com.wire.android.ui.common.topappbar.NavigationIconType import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar import com.wire.android.ui.common.visbility.rememberVisibilityState import com.wire.android.ui.home.conversations.PermissionPermanentlyDeniedDialogState @@ -281,6 +282,7 @@ private fun AvatarPickerActionButtons( private fun AvatarPickerTopBar(onCloseClick: () -> Unit) { WireCenterAlignedTopAppBar( onNavigationPressed = onCloseClick, + navigationIconType = NavigationIconType.Back(R.string.content_description_change_picture_back_btn), title = stringResource(R.string.profile_image_top_bar_label), ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/userprofile/common/UserProfileInfo.kt b/app/src/main/kotlin/com/wire/android/ui/userprofile/common/UserProfileInfo.kt index 087eece0d8a..fd62d45a987 100644 --- a/app/src/main/kotlin/com/wire/android/ui/userprofile/common/UserProfileInfo.kt +++ b/app/src/main/kotlin/com/wire/android/ui/userprofile/common/UserProfileInfo.kt @@ -146,6 +146,7 @@ fun UserProfileInfo( targetState = userAvatarData to showPlaceholderIfNoAsset.value, label = "UserProfileInfoAvatar" ) { (userAvatarData, showPlaceholderIfNoAsset) -> + val onAvatarClickDescription = stringResource(R.string.content_description_change_it_label) UserProfileAvatar( size = dimensions().avatarDefaultBigSize, temporaryUserBorderWidth = dimensions().avatarBigTemporaryUserBorderWidth, @@ -154,12 +155,14 @@ fun UserProfileInfo( Clickable( enabled = editableState is EditableState.IsEditable, clickBlockParams = ClickBlockParams(blockWhenSyncing = true, blockWhenConnecting = true), + onClickDescription = onAvatarClickDescription, ) { onUserProfileClick?.invoke() } }, showPlaceholderIfNoAsset = showPlaceholderIfNoAsset, withCrossfadeAnimation = true, type = expiresAt?.let { UserProfileAvatarType.WithIndicators.TemporaryUser(expiresAt) } - ?: UserProfileAvatarType.WithoutIndicators + ?: UserProfileAvatarType.WithoutIndicators, + contentDescription = stringResource(R.string.content_description_self_profile_avatar) ) } this@Column.AnimatedVisibility(visible = isLoading) { @@ -194,13 +197,16 @@ fun UserProfileInfo( isMLSVerified = isMLSVerified ) + val profileNameDescription = + stringResource(R.string.content_description_self_profile_profile_name, fullName) Text( modifier = Modifier .padding(horizontal = dimensions().spacing16x) .constrainAs(displayName) { start.linkTo(parent.start) end.linkTo(parent.end) - }, + } + .semantics(mergeDescendants = true) { contentDescription = profileNameDescription }, text = text, // TODO. replace with MIDDLE_ELLIPSIS when available see https://issuetracker.google.com/issues/185418980 overflow = TextOverflow.Visible, @@ -220,13 +226,16 @@ fun UserProfileInfo( top.linkTo(displayName.bottom) } ) { + val usernameDescription = + stringResource(R.string.content_description_self_profile_username, userName) Text( text = processUsername(userName, membership, expiresAt), overflow = TextOverflow.Ellipsis, style = MaterialTheme.wireTypography.body02, maxLines = 2, textAlign = TextAlign.Center, - color = MaterialTheme.wireColorScheme.labelText + color = MaterialTheme.wireColorScheme.labelText, + modifier = Modifier.semantics(mergeDescendants = true) { contentDescription = usernameDescription } ) UserBadge(membership, connection, topPadding = dimensions().spacing8x) } @@ -259,10 +268,12 @@ fun UserProfileInfo( } if (teamName != null) { + val teamDescription = stringResource(R.string.content_description_self_profile_team, teamName) TeamInformation( modifier = Modifier .padding(top = dimensions().spacing8x) - .padding(horizontal = dimensions().spacing16x), + .padding(horizontal = dimensions().spacing16x) + .semantics(mergeDescendants = true) { contentDescription = teamDescription }, teamName = teamName ) } diff --git a/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt b/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt index 449c59e2b59..49366b29a5e 100644 --- a/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/userprofile/self/SelfUserProfileScreen.kt @@ -220,6 +220,7 @@ private fun SelfUserProfileContent( .background(MaterialTheme.colorScheme.background) .padding(internalPadding) ) { + val selectLabel = stringResource(R.string.content_description_select_label) LazyColumn( modifier = Modifier .weight(1F) @@ -275,9 +276,9 @@ private fun SelfUserProfileContent( items = otherAccounts, itemContent = { account -> OtherAccountItem( - account, + account = account, clickable = remember { - Clickable(enabled = true, onClick = { + Clickable(enabled = true, onClickDescription = selectLabel, onClick = { if (isUserInCall()) { Toast.makeText( context, @@ -288,7 +289,8 @@ private fun SelfUserProfileContent( onOtherAccountClick(account.id) } }) - }) + } + ) } ) } @@ -329,7 +331,8 @@ private fun SelfUserProfileTopBar( WireCenterAlignedTopAppBar( onNavigationPressed = onCloseClick, title = stringResource(id = R.string.user_profile_title), - navigationIconType = NavigationIconType.Close(), + navigationIconType = NavigationIconType.Close(R.string.content_description_self_profile_close), + titleContentDescription = stringResource(R.string.content_description_self_profile_heading), elevation = 0.dp, actions = { WireSecondaryButton( @@ -378,7 +381,8 @@ private fun CurrentSelfUserStatus( ), autoUpdateSelection = false, showDefaultTextIndicator = false, - leadingCompose = { index -> UserStatusIndicator(items[index]) } + leadingCompose = { index -> UserStatusIndicator(items[index]) }, + onChangeClickDescription = stringResource(R.string.content_description_self_profile_change_status) ) { selectedIndex -> onStatusClicked(items[selectedIndex]) } @@ -403,6 +407,7 @@ private fun NewTeamButton( .padding(dimensions().spacing16x) .testTag("New Team or Account"), text = stringResource(R.string.user_profile_new_account_text), + onClickDescription = stringResource(R.string.content_description_self_profile_new_account_btn), onClick = remember { { if (isUserIdCall()) { @@ -448,7 +453,7 @@ private fun OtherAccountItem( .wrapContentWidth() .padding(end = MaterialTheme.wireDimensions.spacing8x) ) { - ArrowRightIcon(Modifier.align(Alignment.TopEnd)) + ArrowRightIcon(Modifier.align(Alignment.TopEnd), R.string.content_description_empty) } }, clickable = clickable, diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0cb41eae6dd..5a0affcfba9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -186,7 +186,6 @@ Close conversation details adjust guest access adjust self-deleting time - User Profile, heading Open conversation options Go back to conversation details Edit role @@ -196,7 +195,6 @@ Close connection request view Search text messages Open overview of pictures and files - Add participant, heading Close add partipants view Search people by name or username Go back to add participants view @@ -210,20 +208,36 @@ select unselect selected - %s, heading toggle setting Go back to conversation details Go back to conversation details open profile open conversation open service + change it + open link + Alert + close dropdown open notification settings Go back to new conversation view - New group, heading Type group name - Conversation options, heading + Conversation options Go back to new group creation pending approval of connection request + Close your profile + Your profile + Your profile picture + Profile name, %s + Username, %s + Team name, %s + change availability status + Create a new team or personal account or log in + Go back to your profile overview + Close new team creation and login view + Go back to new team creation and login view + enter your email or username + enter your password + enter your SSO code or Wire email https://medium.com/wire-news/android-updates/home diff --git a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/Extensions.kt b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/Extensions.kt index a428e3f9c7a..67a47a79c7e 100644 --- a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/Extensions.kt +++ b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/Extensions.kt @@ -76,27 +76,12 @@ fun Modifier.clickable(clickable: Clickable?) = clickable?.let { this.combinedClickable( enabled = clickable.enabled, onClick = onClick, - onLongClick = onLongClick + onLongClick = onLongClick, + onClickLabel = clickable.onClickDescription, + onLongClickLabel = clickable.onLongClickDescription ) } else { // even though element is disabled we want to merge all inner elements into one for TalkBack this.semantics(mergeDescendants = true) { } } } ?: this - -@SuppressLint("ComposeComposableModifier", "ComposeModifierWithoutDefault") -@Composable -fun Modifier.clickableDescriptions(clickable: Clickable?) = if (clickable?.enabled == true) { - this.semantics { - clickable.onClickDescription?.let { - this@semantics.onClick(it) { true } - } - if (clickable.onLongClick != null) { - clickable.onLongClickDescription?.let { - this@semantics.onLongClick(it) { true } - } - } - } -} else { - this -} diff --git a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/WireDialog.kt b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/WireDialog.kt index 748dfb8255a..b4e0ab63aa6 100644 --- a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/WireDialog.kt +++ b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/WireDialog.kt @@ -40,6 +40,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Shape import androidx.compose.ui.platform.LocalUriHandler +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.paneTitle import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle @@ -83,6 +85,7 @@ fun WireDialog( properties: DialogProperties = DialogProperties(usePlatformDefaultWidth = false), centerContent: Boolean = false, titleLoading: Boolean = false, + dialogDescription: String = stringResource(R.string.content_description_alert), content: @Composable (() -> Unit)? = null ) { WireDialog( @@ -109,6 +112,7 @@ fun WireDialog( }, textSuffixLink = textSuffixLink, centerContent = centerContent, + dialogDescription = dialogDescription, content = content ) } @@ -129,6 +133,7 @@ fun WireDialog( properties: DialogProperties = DialogProperties(usePlatformDefaultWidth = false), centerContent: Boolean = false, titleLoading: Boolean = false, + dialogDescription: String = stringResource(R.string.content_description_alert), content: @Composable (() -> Unit)? = null ) { Dialog( @@ -140,7 +145,7 @@ fun WireDialog( optionButton2Properties = optionButton2Properties, dismissButtonProperties = dismissButtonProperties, buttonsHorizontalAlignment = buttonsHorizontalAlignment, - modifier = modifier, + modifier = modifier.semantics { paneTitle = dialogDescription }, shape = shape, contentPadding = contentPadding, title = title, diff --git a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/MenuBottomSheetItem.kt b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/MenuBottomSheetItem.kt index 53ad19e1a2b..c4de8644827 100644 --- a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/MenuBottomSheetItem.kt +++ b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/bottomsheet/MenuBottomSheetItem.kt @@ -42,7 +42,6 @@ import androidx.compose.ui.unit.dp import com.wire.android.model.ClickBlockParams import com.wire.android.model.Clickable import com.wire.android.ui.common.clickable -import com.wire.android.ui.common.clickableDescriptions import com.wire.android.ui.common.divider.WireDivider import com.wire.android.ui.theme.wireDimensions import com.wire.android.ui.theme.wireTypography @@ -74,7 +73,6 @@ fun MenuBottomSheetItem( .defaultMinSize(minHeight = MaterialTheme.wireDimensions.conversationBottomSheetItemHeight) .fillMaxWidth() .clickable(clickable) - .clickableDescriptions(clickable) .padding(MaterialTheme.wireDimensions.conversationBottomSheetItemPadding) ) { if (icon != null) { diff --git a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/topappbar/WireCenterAlignedTopAppBar.kt b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/topappbar/WireCenterAlignedTopAppBar.kt index f36138ac40f..6628f9a107f 100644 --- a/core/ui-common/src/main/kotlin/com/wire/android/ui/common/topappbar/WireCenterAlignedTopAppBar.kt +++ b/core/ui-common/src/main/kotlin/com/wire/android/ui/common/topappbar/WireCenterAlignedTopAppBar.kt @@ -34,8 +34,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalDensity -import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.heading import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.TextLayoutResult import androidx.compose.ui.text.TextStyle @@ -44,7 +44,6 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.wire.android.ui.common.R import com.wire.android.ui.common.dimensions import com.wire.android.ui.theme.WireTheme import com.wire.android.ui.theme.wireDimensions @@ -62,7 +61,7 @@ fun WireCenterAlignedTopAppBar( onNavigationPressed: () -> Unit = {}, navigationIconType: NavigationIconType? = NavigationIconType.Back(), elevation: Dp = MaterialTheme.wireDimensions.topBarShadowElevation, - titleContentDescription: String? = stringResource(id = R.string.content_description_heading_suffix, title), + titleContentDescription: String? = null, actions: @Composable RowScope.() -> Unit = {}, bottomContent: @Composable ColumnScope.() -> Unit = {} ) { @@ -125,20 +124,14 @@ fun WireTopAppBarTitle( style: TextStyle, modifier: Modifier = Modifier, maxLines: Int = 2, - contentDescription: String? = stringResource(id = R.string.content_description_heading_suffix, title) + contentDescription: String? = null ) { // There's an ongoing issue about multiline text taking all width available instead of wrapping visible text. // https://issuetracker.google.com/issues/206039942 // It's very noticeable on TopAppBar because due to that issue, the title is not centered, even if there are large enough empty spaces // on both sides and all lines of text are actually shorter and could fit at the center. // This workaround is based on this: https://stackoverflow.com/a/69947555, but instead of using SubcomposeLayout, we just measure text. - BoxWithConstraints( - modifier = modifier - .semantics { - contentDescription?.let { this.contentDescription = contentDescription } - } - .padding(horizontal = dimensions().spacing6x) - ) { + BoxWithConstraints(modifier = modifier.padding(horizontal = dimensions().spacing6x)) { val textMeasurer = rememberTextMeasurer() val textLayoutResult: TextLayoutResult = textMeasurer.measure( text = title, @@ -158,7 +151,12 @@ fun WireTopAppBarTitle( }.toDp() } Text( - modifier = Modifier.width(width), + modifier = Modifier + .width(width) + .semantics { + heading() + contentDescription?.let { this.contentDescription = it } + }, text = title, style = style, maxLines = maxLines, diff --git a/core/ui-common/src/main/res/values/strings.xml b/core/ui-common/src/main/res/values/strings.xml index 80d27d1eb5d..88bc5693363 100644 --- a/core/ui-common/src/main/res/values/strings.xml +++ b/core/ui-common/src/main/res/values/strings.xml @@ -23,6 +23,6 @@ Close button Main navigation Drop down arrow - %s, heading pending approval of connection request + Alert