From 1d96d3eb1e1655689741f355e6d2f2024dce8248 Mon Sep 17 00:00:00 2001 From: Kayla Brady <31781298+KaylaBrady@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:01:48 -0500 Subject: [PATCH] fix(VoiceControl): accessibilityInputLabel for sheet nav links (#520) --- iosApp/iosApp/ComponentViews/DirectionRowView.swift | 1 - iosApp/iosApp/ComponentViews/HeadsignRowView.swift | 1 - .../Pages/NearbyTransit/StopDeparturesSummaryList.swift | 7 +++++++ .../Pages/StopDetails/StopDetailsFilteredRouteView.swift | 1 + iosApp/iosApp/Pages/TripDetails/TripDetailsStopView.swift | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/iosApp/iosApp/ComponentViews/DirectionRowView.swift b/iosApp/iosApp/ComponentViews/DirectionRowView.swift index 898813977..afa1fdb97 100644 --- a/iosApp/iosApp/ComponentViews/DirectionRowView.swift +++ b/iosApp/iosApp/ComponentViews/DirectionRowView.swift @@ -29,7 +29,6 @@ struct DirectionRowView: View { DirectionLabel(direction: direction) .foregroundStyle(Color.text) } - .accessibilityInputLabels([direction.destination ?? direction.name]) } } diff --git a/iosApp/iosApp/ComponentViews/HeadsignRowView.swift b/iosApp/iosApp/ComponentViews/HeadsignRowView.swift index 6cf95daf2..f9dad621a 100644 --- a/iosApp/iosApp/ComponentViews/HeadsignRowView.swift +++ b/iosApp/iosApp/ComponentViews/HeadsignRowView.swift @@ -31,7 +31,6 @@ struct HeadsignRowView: View { .font(Typography.bodySemibold) .multilineTextAlignment(.leading) } - .accessibilityInputLabels([headsign]) } } diff --git a/iosApp/iosApp/Pages/NearbyTransit/StopDeparturesSummaryList.swift b/iosApp/iosApp/Pages/NearbyTransit/StopDeparturesSummaryList.swift index 0453b9581..cc2aa1c13 100644 --- a/iosApp/iosApp/Pages/NearbyTransit/StopDeparturesSummaryList.swift +++ b/iosApp/iosApp/Pages/NearbyTransit/StopDeparturesSummaryList.swift @@ -22,6 +22,12 @@ struct StopDeparturesSummaryList: View { Array(patternsByStop.patterns.enumerated()), id: \.element.id ) { index, patterns in + + let inputLabel = switch onEnum(of: patterns) { + case let .byHeadsign(byHeadsign): byHeadsign.headsign + case let .byDirection(byDirection): byDirection.direction.destination ?? byDirection.direction.name + } + VStack(spacing: 0) { SheetNavigationLink( value: .stopDetails( @@ -36,6 +42,7 @@ struct StopDeparturesSummaryList: View { condenseHeadsignPredictions: condenseHeadsignPredictions ) } + .accessibilityInputLabels([inputLabel]) .padding(8) .frame(minHeight: 44) .padding(.leading, 8) diff --git a/iosApp/iosApp/Pages/StopDetails/StopDetailsFilteredRouteView.swift b/iosApp/iosApp/Pages/StopDetails/StopDetailsFilteredRouteView.swift index 7ad48fa5d..d6abb5a10 100644 --- a/iosApp/iosApp/Pages/StopDetails/StopDetailsFilteredRouteView.swift +++ b/iosApp/iosApp/Pages/StopDetails/StopDetailsFilteredRouteView.swift @@ -199,6 +199,7 @@ struct StopDetailsFilteredRouteView: View { .onRow(route: row.route) : .none ) } + .accessibilityInputLabels([row.headsign]) .padding(.vertical, 10) .padding(.horizontal, 16) diff --git a/iosApp/iosApp/Pages/TripDetails/TripDetailsStopView.swift b/iosApp/iosApp/Pages/TripDetails/TripDetailsStopView.swift index 873204719..02629d759 100644 --- a/iosApp/iosApp/Pages/TripDetails/TripDetailsStopView.swift +++ b/iosApp/iosApp/Pages/TripDetails/TripDetailsStopView.swift @@ -30,7 +30,7 @@ struct TripDetailsStopView: View { .accessibilityAddTraits(.isHeader) .accessibilityHeading(.h2) } - ) + ).accessibilityInputLabels([stop.stop.name]) if !stop.routes.isEmpty { scrollRoutes .accessibilityElement()