mirror of
https://github.com/bitwarden/android.git
synced 2026-03-11 20:54:58 -05:00
PM-33112: Avoid double announcement of BitwardenSwitch content description (#6611)
This commit is contained in:
@@ -20,6 +20,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.testTag
|
import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.semantics.contentDescription
|
import androidx.compose.ui.semantics.contentDescription
|
||||||
|
import androidx.compose.ui.semantics.hideFromAccessibility
|
||||||
import androidx.compose.ui.semantics.semantics
|
import androidx.compose.ui.semantics.semantics
|
||||||
import androidx.compose.ui.semantics.toggleableState
|
import androidx.compose.ui.semantics.toggleableState
|
||||||
import androidx.compose.ui.state.ToggleableState
|
import androidx.compose.ui.state.ToggleableState
|
||||||
@@ -261,7 +262,7 @@ fun BitwardenSwitch(
|
|||||||
)
|
)
|
||||||
.semantics(mergeDescendants = true) {
|
.semantics(mergeDescendants = true) {
|
||||||
toggleableState = ToggleableState(isChecked)
|
toggleableState = ToggleableState(isChecked)
|
||||||
contentDescription?.let { this.contentDescription = it }
|
this.contentDescription = contentDescription ?: label.text
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
@@ -283,7 +284,12 @@ fun BitwardenSwitch(
|
|||||||
} else {
|
} else {
|
||||||
BitwardenTheme.colorScheme.filledButton.foregroundDisabled
|
BitwardenTheme.colorScheme.filledButton.foregroundDisabled
|
||||||
},
|
},
|
||||||
modifier = Modifier.testTag(tag = "SwitchText"),
|
modifier = Modifier
|
||||||
|
.semantics {
|
||||||
|
// The top-level content description will handle this callout.
|
||||||
|
hideFromAccessibility()
|
||||||
|
}
|
||||||
|
.testTag(tag = "SwitchText"),
|
||||||
)
|
)
|
||||||
tooltip?.let {
|
tooltip?.let {
|
||||||
ToolTip(
|
ToolTip(
|
||||||
|
|||||||
Reference in New Issue
Block a user