Implementing the “one or more” UI component
verbnounenter.net
verbnounenter.net
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.
> 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.
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.
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.
Instead of a list of languages with the title "Languages" and a pale, tiny "Install" button, why not something like this?
----
Which languages would you like to install?
* English
* Français
* 日本語
* tlhIngan Hol
* Lobjan
(Install)
----
The "install" would initially be inactive, and transition to an active state when one or more language(s) is selected.
There is a principle "let user click" formulated by Ilya Birman, which means "let user enter whatever data they want and then deal with it separately". E.g. i'd like to be able to uncheck any checkbox before selecting a different one. Or clear the text to paste some other text. If there is a hardcoded logic that prohibits any of these intermediate states, people would be constantly frustrated.
Food delivery apps say "select one or more options" and let you uncheck anything with a separate validation. These guys literally make money by optimizing for happiness — their job is the best UX scientific experiment out there.
I tend to agree with other commenters here that it's better to just make a checkbox list and require one to be selected. Or in cases like language, maybe have a primary radio (mandatory) and a secondary checkbox (optional) section, where you need to select a language for the app to show you thinks in but can indicate interest in other languages' content.
[0] http://stereo.jpn.org/eng/stphmkr/toolbar/image/toolmenu.png
iOS has tables. A table is a single column of complex cells that usually fills the screen. Cells can be divided into sections or not divided. The Settings app is almost entirely tables; so is a Twitter app, so was the iPod. Table cells can have a checkmark accessory—just a glyph, not surrounded by any shape—that is either exclusive to one among many rows or not exclusive. Originally, a single or multiple selection field would push another screen with a table whose cells would provide the behavior you want. Tapping anywhere in a cell selects it, displays the checkmark, and if desired removes it from other cells. The user pops the screen when done.
This is all the same as what you find in the macOS Menu Bar—items may be grouped between dividers, some items may disclose another column of options, some may have a persistent selection state, the selection states of nearby items may be mutual or individual. macOS menus also never had checkboxes or radio buttons but can have either kind of selection indicated by a checkmark. Table screens are menus.
iOS also decorates arbitrary objects like photos with a checkmark in similar situations—put the Photos app into selection mode for example. There is no checkbox control to aim for. You hit the entire object and it performs the appropriate selection behavior, which results in a checkmark being displayed or hidden.
I believe the reason iOS has an object decoration instead of either checkboxes or radio buttons is that fingers are blunt and users enjoy big tap targets. Trying to poke at a small circle or box to the left of some accompanying text kinda sucks. The whole of the text could be an active touch area but a user wouldn't know that from looking at it.
Have a look at switches for comparison—they're big, they can be tapped or dragged, they play haptics. But the text beside them does not activate them because it doesn't look like a thing you can handle, not like the switch itself, not like the checkmark-gaining photo or a mail message table cell.
I think the reason this question is still asked is that the HIG doesn't address expectations about a missing control. To my knowledge Apple has never in this era explained their design reasoning, maybe because intuitive UI has historically been their competitive advantage. So we identify patterns largely from repeated anecdotal use and make educated guesses about the reasoning. In the end it means that long-time users of iPhone are at times more aware of UI norms than career designers who aren't particularly iPhone specialists. And sometimes, despite knowing better, we design and build custom radio buttons because a stakeholder couldn't be convinced.
I don't think we have any real-life controls that we interact with that have this behavior so it's not easy to see a clear affordance.
Strictly superior here is the default in the article -- allow them to unselect, but disable the "continue" button.
It was a fun experiment and I liked the result. Still, I wouldn't do this outside of a hobby project (at least not without a very good reason and a lot of resources).
[1]: https://merely.xyz/blog/2023/001-lets-design-a-new-form-elem...
on_click() {
if (last_one()) alert('You must keep at least one item selected.');
else actually_toggle_it_off();
}
Simple. Does not need fancy code. User immediately knows what he has to do, with no thinking required.As much as possible you should stay out of the users way and let them decide how to interact.
From my experience, every time you feel the need to do something "auto-magic" in code, don't. The user will not know what is happening or why. It's easy for developers to understand this but what I've found is that managers will be the ones insisting on this kind of crap. I guess it's something they can use in meetings to gaslight the customer and hide their failures.
to be fair, this design is interesting and refreshing, but I feel it only works well for short lists where you can always see all options at the same time