From ef260b922291da357480c26553527c1ce69b777c Mon Sep 17 00:00:00 2001 From: amddg44 Date: Fri, 4 Oct 2024 16:42:40 +0200 Subject: [PATCH] Fix failing password-management maestro test (#3413) Task/Issue URL: https://app.asana.com/0/1201462886803403/1208448205292549/f Tech Design URL: CC: **Description**: Fixes issue where including a swiftUI component in the tableview header caused a maestro crash as too many accessibility layout updates fired while animating from search controller results view back to normal table layout. I also improved the accessibility of the Sync Promo (setting irrelevant UI elements as hidden, accessibility labels on buttons etc) --- DuckDuckGo/SyncPromoView.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/DuckDuckGo/SyncPromoView.swift b/DuckDuckGo/SyncPromoView.swift index a77a410ad2..b9539aa78f 100644 --- a/DuckDuckGo/SyncPromoView.swift +++ b/DuckDuckGo/SyncPromoView.swift @@ -24,6 +24,7 @@ import DuckUI struct SyncPromoView: View { let viewModel: SyncPromoViewModel + @State private var isAccessibilityHidden = true var body: some View { ZStack(alignment: .topTrailing) { @@ -31,6 +32,8 @@ struct SyncPromoView: View { Group { Image(viewModel.image) .scaledToFit() + .accessibilityHidden(true) + Text(viewModel.title) .padding(.top, 4) .frame(maxWidth: .infinity) @@ -48,6 +51,7 @@ struct SyncPromoView: View { Text(viewModel.secondaryButtonTitle) } .buttonStyle(SecondaryFillButtonStyle(compact: true, fullWidth: false)) + .accessibilityLabel(viewModel.secondaryButtonTitle) Button { viewModel.primaryButtonAction?() @@ -55,6 +59,7 @@ struct SyncPromoView: View { Text(viewModel.primaryButtonTitle) } .buttonStyle(PrimaryButtonStyle(compact: true, fullWidth: false)) + .accessibilityLabel(viewModel.primaryButtonTitle) } .padding(.top, 12) @@ -81,6 +86,7 @@ struct SyncPromoView: View { .alignmentGuide(.top) { dimension in dimension[.top] } + .accessibilityHidden(true) } .background( RoundedRectangle(cornerRadius: 8) @@ -88,6 +94,13 @@ struct SyncPromoView: View { ) .padding(.horizontal, 20) .padding(.bottom, 12) + .accessibilityHidden(isAccessibilityHidden) + .onAppear { + // Delay accessibility activation for maestro + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { + isAccessibilityHidden = false + } + } } }