Skip to content

Commit 5f2d365

Browse files
committed
Resolve accessibility group conflict for conditional date picker
1 parent e307cab commit 5f2d365

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

WooCommerce/Classes/ViewRelated/Blaze/BudgetSetting/BlazeScheduleSettingView.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct BlazeScheduleSettingView: View {
4343
AdaptiveStack(horizontalAlignment: .leading) {
4444
Text(Localization.startDate)
4545
.bodyStyle()
46+
.accessibilityHidden(true)
4647

4748
Spacer().renderedIf(sizeCategory.isAccessibilityCategory == false)
4849

@@ -58,8 +59,6 @@ struct BlazeScheduleSettingView: View {
5859
view.datePickerStyle(.compact)
5960
}
6061
}
61-
.accessibilityElement(children: .combine)
62-
.accessibilityAddTraits(.isButton)
6362
.accessibilityHint(Localization.startDateAccessibilityHint)
6463
.accessibilityLabel(
6564
String(
@@ -71,6 +70,18 @@ struct BlazeScheduleSettingView: View {
7170
)
7271
)
7372
)
73+
// Apply accessibility grouping only for non-accessibility size categories.
74+
// For accessibility size categories, we use .graphical date picker style which is embedded
75+
// directly in the view and maintains its native "date picker" traits. For standard size
76+
// categories, we use .compact date picker style which acts as a popover, so we group the
77+
// elements with .combine and add .isButton trait to make the entire section actionable.
78+
// Applying .combine to the graphical date picker would override its native accessibility
79+
// traits and degrade the user experience.
80+
.if(!sizeCategory.isAccessibilityCategory) { view in
81+
view
82+
.accessibilityElement(children: .combine)
83+
.accessibilityAddTraits(.isButton)
84+
}
7485

7586
// Toggle to switch between evergreen and not. Hidden under a feature flag.
7687
Toggle(Localization.specifyDuration, isOn: $hasEndDate)

0 commit comments

Comments
 (0)