mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Merge pull request #7135 from element-hq/fix/a11y-message-composer
Fix accessibility for message composer input and read receipts button
This commit is contained in:
+5
-9
@@ -25,9 +25,10 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.res.pluralStringResource
|
import androidx.compose.ui.res.pluralStringResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.semantics.clearAndSetSemantics
|
import androidx.compose.ui.semantics.clearAndSetSemantics
|
||||||
import androidx.compose.ui.semantics.contentDescription
|
import androidx.compose.ui.semantics.contentDescription
|
||||||
import androidx.compose.ui.semantics.hideFromAccessibility
|
import androidx.compose.ui.semantics.role
|
||||||
import androidx.compose.ui.semantics.testTag
|
import androidx.compose.ui.semantics.testTag
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -57,18 +58,12 @@ fun TimelineItemReadReceiptView(
|
|||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
if (state.receipts.isNotEmpty()) {
|
if (state.receipts.isNotEmpty()) {
|
||||||
ReadReceiptsRow(
|
ReadReceiptsRow(modifier = modifier) {
|
||||||
modifier = modifier.clearAndSetSemantics {
|
|
||||||
hideFromAccessibility()
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
ReadReceiptsAvatars(
|
ReadReceiptsAvatars(
|
||||||
receipts = state.receipts,
|
receipts = state.receipts,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(RoundedCornerShape(4.dp))
|
.clip(RoundedCornerShape(4.dp))
|
||||||
.clickable {
|
.clickable(onClick = onReadReceiptsClick)
|
||||||
onReadReceiptsClick()
|
|
||||||
}
|
|
||||||
.padding(2.dp)
|
.padding(2.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -140,6 +135,7 @@ private fun ReadReceiptsAvatars(
|
|||||||
.clearAndSetSemantics {
|
.clearAndSetSemantics {
|
||||||
testTag = TestTags.messageReadReceipts.value
|
testTag = TestTags.messageReadReceipts.value
|
||||||
contentDescription = receiptDescription
|
contentDescription = receiptDescription
|
||||||
|
role = Role.Button
|
||||||
},
|
},
|
||||||
horizontalArrangement = Arrangement.spacedBy(4.dp - avatarStrokeSize),
|
horizontalArrangement = Arrangement.spacedBy(4.dp - avatarStrokeSize),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|||||||
+2
@@ -93,6 +93,7 @@ fun MarkdownTextInput(
|
|||||||
setText(text)
|
setText(text)
|
||||||
setHint(placeholder)
|
setHint(placeholder)
|
||||||
setHintTextColor(ColorStateList.valueOf(placeholderColor.toArgb()))
|
setHintTextColor(ColorStateList.valueOf(placeholderColor.toArgb()))
|
||||||
|
contentDescription = placeholder
|
||||||
inputType = InputType.TYPE_CLASS_TEXT or
|
inputType = InputType.TYPE_CLASS_TEXT or
|
||||||
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES or
|
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES or
|
||||||
InputType.TYPE_TEXT_FLAG_MULTI_LINE or
|
InputType.TYPE_TEXT_FLAG_MULTI_LINE or
|
||||||
@@ -129,6 +130,7 @@ fun MarkdownTextInput(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
update = { editText ->
|
update = { editText ->
|
||||||
|
editText.contentDescription = placeholder
|
||||||
editText.applyStyleInCompose(richTextEditorStyle)
|
editText.applyStyleInCompose(richTextEditorStyle)
|
||||||
val text = state.text.value()
|
val text = state.text.value()
|
||||||
mentionSpanUpdater.updateMentionSpans(text)
|
mentionSpanUpdater.updateMentionSpans(text)
|
||||||
|
|||||||
Reference in New Issue
Block a user