vanilla-framework icon indicating copy to clipboard operation
vanilla-framework copied to clipboard

Progressive disclosure in radio button forms

Open dgtlntv opened this issue 2 years ago • 6 comments

Visual

image

Context

You can ask the user a related question when they select a particular radio option, so they only see the question when it’s relevant to them.

This might make two related questions easier to answer by grouping them on the same page. For example, you could reveal a phone number input when the user selects the ‘Contact me by phone’ option.

This pattern is used in other design systems like gov.uk's and is accessible.

State

Closed state: image

Opened state: image

dgtlntv avatar Oct 13 '23 08:10 dgtlntv

An example implementation can be found as a PR in the maas-react-components library.

dgtlntv avatar Oct 17 '23 07:10 dgtlntv

Validated in the working group meeting. @bartaz To look at the implementation of it.

danielmutis avatar Oct 18 '23 09:10 danielmutis

@dgtlntv Are we limiting this to only radio/checkbox inputs? Can other input types be nested, like text inputs?

Any rules on how many nested elements can be there?

bartaz avatar Oct 18 '23 10:10 bartaz

For the parent element, I would say yes, only radios and check boxes. As for the nested elements, I think other input types should be allowed. A rule about how many elements can be nested is a bit context and input type dependent in my opinion. There should be no more than one additional question asked and in the best case it means no more than one additional input. This is also the recommendation of the designers at gov.uk. In my example above, to answer the one extra question I needed two radio buttons, which I think is still fine. I'm not sure if there is a general rule that can be reflected in the code, but I could write a few sentences of UX documentation about it.

dgtlntv avatar Oct 20 '23 08:10 dgtlntv

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/WD-15243.

This message was autogenerated

Triage: high effort, high impact. To be implemented in new architecture.

bartaz avatar Sep 24 '24 08:09 bartaz