From f833bc3a6f2acebb8e312f8be38e7898f7020ca3 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 13 Feb 2023 20:27:05 -0500 Subject: [PATCH] Apply accessibility labels to MenuPicker actions --- Tusker/Views/MenuPicker.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/MenuPicker.swift b/Tusker/Views/MenuPicker.swift index 539c816f..03dc3c44 100644 --- a/Tusker/Views/MenuPicker.swift +++ b/Tusker/Views/MenuPicker.swift @@ -39,9 +39,11 @@ struct MenuPicker: UIViewRepresentable { } button.configuration = config button.menu = UIMenu(children: options.map { opt in - UIAction(title: opt.title, subtitle: opt.subtitle, image: opt.image, state: opt.value == selection ? .on : .off) { _ in + let action = UIAction(title: opt.title, subtitle: opt.subtitle, image: opt.image, state: opt.value == selection ? .on : .off) { _ in selection = opt.value } + action.accessibilityLabel = opt.accessibilityLabel + return action }) button.accessibilityLabel = selectedOption.accessibilityLabel ?? selectedOption.title button.isPointerInteractionEnabled = buttonStyle == .iconOnly