forked from shadowfacts/Tusker
Apply accessibility labels to MenuPicker actions
This commit is contained in:
parent
4731801893
commit
f833bc3a6f
|
@ -39,9 +39,11 @@ struct MenuPicker<Value: Hashable>: UIViewRepresentable {
|
||||||
}
|
}
|
||||||
button.configuration = config
|
button.configuration = config
|
||||||
button.menu = UIMenu(children: options.map { opt in
|
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
|
selection = opt.value
|
||||||
}
|
}
|
||||||
|
action.accessibilityLabel = opt.accessibilityLabel
|
||||||
|
return action
|
||||||
})
|
})
|
||||||
button.accessibilityLabel = selectedOption.accessibilityLabel ?? selectedOption.title
|
button.accessibilityLabel = selectedOption.accessibilityLabel ?? selectedOption.title
|
||||||
button.isPointerInteractionEnabled = buttonStyle == .iconOnly
|
button.isPointerInteractionEnabled = buttonStyle == .iconOnly
|
||||||
|
|
Loading…
Reference in New Issue