kiwicom / orbit-swiftui

Kiwi.com Orbit design system library
MIT License
132 stars 23 forks source link

Check `switch` usage in `Alert` and `Dialog` button builder #667

Open PavelHolec opened 1 year ago

PavelHolec commented 1 year ago

The accessibility of buttons seems to be broken when using a switch. The labels are correct, but the primary accessibility ID is used for all buttons.

sjavora commented 7 months ago

We ran into this internally when updating Dialog modifiers. IIRC, it's a consequence of buildEither's return value getting forwarded to

public static func buildBlock(_ primary: some View) -> some View {
    primaryButton(primary)
}

...which then applies the primaryButton to whatever is inside, including a stack of multiple buttons. We can't solve this by overloading buildBlock for Button, because that would only work without modifiers...

I guess we could try adding an overload that explicitly takes a _ConditionalContent...