Skip to content

Commit 0b66f56

Browse files
committed
fix: error message vocalization for radio item
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
1 parent 2cba7d7 commit 0b66f56

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

OUDS/Core/Components/Sources/Controls/Radio/OUDSRadioItem.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,12 @@ public struct OUDSRadioItem: View {
259259
/// Forges a string to vocalize with *Voice Over* describing the component state.
260260
private var a11yLabel: String {
261261
let stateDescription: String = layoutData.isReadOnly || !isEnabled ? "core_common_disabled_a11y".localized() : ""
262-
let errorPrefix = layoutData.isError ? "core_common_onError_a11y".localized() : ""
263-
let errorText = layoutData.errorText?.localized() ?? ""
264-
let errorDescription = "\(errorPrefix), \(errorText)"
262+
var errorDescription = ""
263+
if layoutData.isError {
264+
let errorPrefix = "core_common_onError_a11y".localized()
265+
let errorText = layoutData.errorText?.localized() ?? ""
266+
errorDescription = "\(errorPrefix), \(errorText)"
267+
}
265268
let radioA11yTrait = "core_radio_trait_a11y".localized() // Fake trait for Voice Over vocalization
266269

267270
let result = "\(stateDescription), \(layoutData.label), \(layoutData.additionalLabel ?? ""), \(layoutData.description ?? "") \(errorDescription), \(radioA11yTrait)"

0 commit comments

Comments
 (0)