Skip to content

Commit ac1de1e

Browse files
committed
Remove custom semantic state description for checkbox and checkbox item
1 parent 01765b8 commit ac1de1e

15 files changed

+2
-26
lines changed

core/src/main/java/com/orange/ouds/core/component/OudsCheckbox.kt

+1-11
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ import androidx.compose.ui.graphics.Shape
4040
import androidx.compose.ui.platform.LocalContext
4141
import androidx.compose.ui.res.painterResource
4242
import androidx.compose.ui.semantics.Role
43-
import androidx.compose.ui.semantics.semantics
44-
import androidx.compose.ui.semantics.stateDescription
4543
import androidx.compose.ui.state.ToggleableState
4644
import androidx.compose.ui.tooling.preview.PreviewParameter
4745
import androidx.compose.ui.unit.Dp
@@ -166,7 +164,6 @@ private fun OudsCheckbox(
166164
exceptionMessage = { "An OudsCheckbox or OudsTriStateCheckbox set to disabled with error parameter activated is not allowed." }
167165
) {
168166
val interactionState by interactionSource.collectInteractionStateAsState()
169-
val context = LocalContext.current
170167
val checkboxTokens = OudsTheme.componentsTokens.checkbox
171168
val state = previewState.orElse { rememberOudsControlState(enabled = enabled, interactionState = interactionState) }
172169

@@ -175,14 +172,7 @@ private fun OudsCheckbox(
175172
.widthIn(checkboxTokens.sizeMinWidth.dp)
176173
.heightIn(min = checkboxTokens.sizeMinHeight.dp, max = checkboxTokens.sizeMaxHeight.dp)
177174
.background(color = backgroundColor(state = state))
178-
.outerBorder(state = state)
179-
.semantics {
180-
stateDescription = when (value) {
181-
ToggleableState.Off -> context.getString(R.string.core_checkbox_unchecked_a11y)
182-
ToggleableState.On -> context.getString(R.string.core_checkbox_checked_a11y)
183-
ToggleableState.Indeterminate -> context.getString(R.string.core_checkbox_indeterminate_a11y)
184-
}
185-
},
175+
.outerBorder(state = state),
186176
contentAlignment = Alignment.Center,
187177
) {
188178
OudsCheckboxIndicator(state = state, value = value, error = error)

core/src/main/java/com/orange/ouds/core/component/OudsCheckboxItem.kt

+1-10
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ import androidx.compose.ui.Modifier
2828
import androidx.compose.ui.platform.LocalContext
2929
import androidx.compose.ui.semantics.Role
3030
import androidx.compose.ui.semantics.semantics
31-
import androidx.compose.ui.semantics.stateDescription
3231
import androidx.compose.ui.state.ToggleableState
3332
import androidx.compose.ui.tooling.preview.PreviewParameter
3433
import androidx.compose.ui.unit.dp
35-
import com.orange.ouds.core.R
3634
import com.orange.ouds.core.extensions.collectInteractionStateAsState
3735
import com.orange.ouds.core.utilities.LoremIpsumText
3836
import com.orange.ouds.core.utilities.OudsPreview
@@ -195,7 +193,6 @@ private fun OudsCheckboxItem(
195193
readOnly: Boolean = false,
196194
error: Boolean = false
197195
) {
198-
val context = LocalContext.current
199196
val interactionState by interactionSource.collectInteractionStateAsState()
200197
val state = previewState.orElse { rememberOudsControlItemState(enabled = enabled, readOnly = readOnly, interactionState = interactionState) }
201198

@@ -223,13 +220,7 @@ private fun OudsCheckboxItem(
223220
ToggleableState.Off -> "Unselected"
224221
ToggleableState.Indeterminate -> "Indeterminate"
225222
},
226-
modifier = modifier.semantics(mergeDescendants = true) {
227-
stateDescription = when (value) {
228-
ToggleableState.Off -> context.getString(R.string.core_checkbox_unchecked_a11y)
229-
ToggleableState.On -> context.getString(R.string.core_checkbox_checked_a11y)
230-
ToggleableState.Indeterminate -> context.getString(R.string.core_checkbox_indeterminate_a11y)
231-
}
232-
}
223+
modifier = modifier.semantics(mergeDescendants = true) {}
233224
)
234225
}
235226

core/src/main/res/values/strings.xml

-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,4 @@
1414
<!-- OudsButton -->
1515
<string name="core_button_loading_a11y">Loading</string>
1616

17-
<!-- OudsCheckbox -->
18-
<string name="core_checkbox_checked_a11y">Checked</string>
19-
<string name="core_checkbox_unchecked_a11y">Unchecked</string>
20-
<string name="core_checkbox_indeterminate_a11y">Indeterminate</string>
21-
2217
</resources>

0 commit comments

Comments
 (0)