mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Fix accessibility label for VoiceMessageButton
This commit is contained in:
committed by
Alfonso Grillo
parent
5823af6a91
commit
1780b58e58
@@ -56,6 +56,7 @@ struct VoiceMessageButton: View {
|
|||||||
.buttonStyle(VoiceMessageButtonStyle())
|
.buttonStyle(VoiceMessageButtonStyle())
|
||||||
.disabled(state == .loading)
|
.disabled(state == .loading)
|
||||||
.background(Circle().foregroundColor(.compound.bgCanvasDefault))
|
.background(Circle().foregroundColor(.compound.bgCanvasDefault))
|
||||||
|
.accessibilityLabel(accessibilityLabel)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
@@ -65,7 +66,6 @@ struct VoiceMessageButton: View {
|
|||||||
ProgressView()
|
ProgressView()
|
||||||
case .playing, .paused:
|
case .playing, .paused:
|
||||||
let imageAsset = state == .playing ? Asset.Images.mediaPause : Asset.Images.mediaPlay
|
let imageAsset = state == .playing ? Asset.Images.mediaPause : Asset.Images.mediaPlay
|
||||||
let accessibilityLabel = state == .playing ? L10n.a11yPause : L10n.a11yPlay
|
|
||||||
let offset: CGFloat = state == .playing ? 0 : 2
|
let offset: CGFloat = state == .playing ? 0 : 2
|
||||||
|
|
||||||
Image(asset: imageAsset)
|
Image(asset: imageAsset)
|
||||||
@@ -73,7 +73,17 @@ struct VoiceMessageButton: View {
|
|||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.frame(width: imageWidth, height: imageHeight)
|
.frame(width: imageWidth, height: imageHeight)
|
||||||
.offset(x: offset)
|
.offset(x: offset)
|
||||||
.accessibilityLabel(accessibilityLabel)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var accessibilityLabel: String {
|
||||||
|
switch state {
|
||||||
|
case .loading:
|
||||||
|
return ""
|
||||||
|
case .playing:
|
||||||
|
return L10n.a11yPause
|
||||||
|
case .paused:
|
||||||
|
return L10n.a11yPlay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user