Give the pinned items banner an explicit accessibility label and value

The view-all button drops its visible text to an empty string while
loading, relying only on a ProgressView for feedback, so VoiceOver
users focusing it while it loads hear an unlabelled button. The main
pinned-item button also has no accessibility label/value describing
which pinned item is shown or its position, since children: .contain
leaves that to implicit merging of its sub-views. Set an explicit
label on the view-all button so it always announces its title, and
give the main button an explicit label (the pinned message) and value
(its position, reusing the existing bannerIndicatorDescription/
screenRoomPinnedBannerIndicator strings) instead of relying on
container merging.
This commit is contained in:
Jürgen Wischer
2026-07-15 11:19:52 +02:00
committed by Mauro
parent 5f6729b737
commit 60cd7fd5cc
@@ -40,9 +40,11 @@ struct PinnedItemsBannerView: View {
}
}
.disabled(state.isLoading)
.accessibilityElement(children: .contain)
.accessibilityElement(children: .ignore)
.accessibilityLabel(Text(state.displayedMessage))
.accessibilityValue(state.count > 1 ? Text(state.bannerIndicatorDescription) : Text(""))
}
private var viewAllButton: some View {
Button { onViewAllButtonTap() } label: {
Text(state.isLoading ? "" : L10n.screenRoomPinnedBannerViewAllButtonTitle)
@@ -58,6 +60,7 @@ struct PinnedItemsBannerView: View {
.padding(.vertical, 5)
}
.disabled(state.isLoading)
.accessibilityLabel(L10n.screenRoomPinnedBannerViewAllButtonTitle)
}
private var content: some View {