mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Merge pull request #7133 from element-hq/fix/a11y-chats-search
Add accessibility label to search input
This commit is contained in:
+6
-2
@@ -33,6 +33,8 @@ import androidx.compose.ui.focus.focusRequester
|
|||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.semantics.contentDescription
|
||||||
|
import androidx.compose.ui.semantics.semantics
|
||||||
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
|
||||||
import io.element.android.compound.tokens.generated.CompoundIcons
|
import io.element.android.compound.tokens.generated.CompoundIcons
|
||||||
@@ -112,10 +114,12 @@ private fun RoomListSearchContent(
|
|||||||
title = {
|
title = {
|
||||||
// The stateSaver will keep the selection state when returning to this UI
|
// The stateSaver will keep the selection state when returning to this UI
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
val searchLabel = stringResource(CommonStrings.action_search)
|
||||||
FilledTextField(
|
FilledTextField(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.focusRequester(focusRequester),
|
.focusRequester(focusRequester)
|
||||||
|
.semantics { contentDescription = searchLabel },
|
||||||
state = state.query,
|
state = state.query,
|
||||||
lineLimits = TextFieldLineLimits.SingleLine,
|
lineLimits = TextFieldLineLimits.SingleLine,
|
||||||
colors = TextFieldDefaults.colors(
|
colors = TextFieldDefaults.colors(
|
||||||
@@ -132,7 +136,7 @@ private fun RoomListSearchContent(
|
|||||||
IconButton(onClick = { state.eventSink(RoomListSearchEvent.ClearQuery) }) {
|
IconButton(onClick = { state.eventSink(RoomListSearchEvent.ClearQuery) }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = CompoundIcons.Close(),
|
imageVector = CompoundIcons.Close(),
|
||||||
contentDescription = stringResource(CommonStrings.action_cancel)
|
contentDescription = stringResource(CommonStrings.a11y_clear_search_field)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<string name="a11y_add_reaction">"Add reaction: %1$s"</string>
|
<string name="a11y_add_reaction">"Add reaction: %1$s"</string>
|
||||||
<string name="a11y_address">"Address"</string>
|
<string name="a11y_address">"Address"</string>
|
||||||
<string name="a11y_avatar">"Avatar"</string>
|
<string name="a11y_avatar">"Avatar"</string>
|
||||||
|
<string name="a11y_clear_search_field">"Clear search field"</string>
|
||||||
<string name="a11y_collapse_message_text_field">"Minimise message text field"</string>
|
<string name="a11y_collapse_message_text_field">"Minimise message text field"</string>
|
||||||
<string name="a11y_create_poll_votes_allowed_decrease">"Decrease votes allowed per person"</string>
|
<string name="a11y_create_poll_votes_allowed_decrease">"Decrease votes allowed per person"</string>
|
||||||
<string name="a11y_create_poll_votes_allowed_increase">"Increase votes allowed per person"</string>
|
<string name="a11y_create_poll_votes_allowed_increase">"Increase votes allowed per person"</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user