Skip to content

Commit 7641259

Browse files
committed
Add accessibility label to order badge view
Introduces an accessibility label to POSOrderBadgeView using a localized string for improved accessibility. Adds a Localization helper to format the label with the order status.
1 parent b40ac0f commit 7641259

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

WooCommerce/Classes/POS/Presentation/Orders/POSOrderBadgeView.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct POSOrderBadgeView: View {
1717
.padding(.vertical, POSPadding.xSmall)
1818
.background(statusBackgroundColor)
1919
.clipShape(RoundedRectangle(cornerRadius: POSCornerRadiusStyle.small.value))
20+
.accessibilityLabel(Localization.badgeAccessibilityLabel(status: order.status.localizedName))
2021
}
2122

2223
private var statusBackgroundColor: Color {
@@ -34,3 +35,16 @@ struct POSOrderBadgeView: View {
3435
}
3536
}
3637
}
38+
39+
private extension POSOrderBadgeView {
40+
enum Localization {
41+
static func badgeAccessibilityLabel(status: String) -> String {
42+
let format = NSLocalizedString(
43+
"pos.orderBadgeView.accessibilityLabel",
44+
value: "Order status: %1$@",
45+
comment: "Accessibility label for order status badge. %1$@ is the status name (e.g., Completed, Failed, Processing)."
46+
)
47+
return String(format: format, status)
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)