by sureIy · 2y ago · 0 comments
The “one of more” component is exactly a list of checkboxes followed by a “confirm selection” button that warns you when nothing is selected.
The constraints is enforce at the time of submission.
Even in real life, when talking to a human who wants one or more words to continue, you won’t be able to continue without giving one or more words.
You wouldn’t want a mandatory text field to insert a random string when you clear it (or have a random string as its initial value), just to maintain the invariant that it must not be blank.
In a similar vein, a set of radio buttons can be initially unselected, in order to force a user selection, even though only selected states are valid states.
Forms and submissions are mostly a web convention. I too think that's more natural, but there are a lot of existing contexts like settings where the expectation is that making the selection doesn't require an explicit "save" step.
If you don't want to deal with validation logic in your app, you could just disable the last checkbox.
Also in practice this state does not happen in “apps”. Before the user reaches the screen, you must have set a default. If you have default, then “deselect all” will eventually revert to that default.
> The constraints is enforce [sic] at the time of submission.
Perhaps it would be better to have all items selected initially. The user deselects those that they do not want. If they try to deselect everything then they get a warning popup at that point.