A customer asked for some help implementing a combo box with a special behavior: When one specific item is selected, it should open a dialog box. They were using a data binding framework and tried to open a dialog when the bound property had a certain value, but it wasn’t working properly. They wanted to know the recommended way of implementing this behavior.
The recommended way to implement this behavior is not to implement this behavior.
Combo box selections should not trigger actions when selected.
One reason not to open a dialog box when a combo box item is selected is that if the default item in the combo box is the special one, then when that combo box initializes, it will set the default item to that special item, and then your app will open that dialog box, even though the user didn’t do anything. They will just go to the page that contains the combo box, and this dialog box will suddenly open.
Now, you can work around this by suppressing the dialog box when the combo box is initializing, so this specific issue could be fixed.
It also means that if the user has already selected the special combo box item, and they want to open the dialog box again, they have to select some other item, then select the special item again.
A more important reason for not opening a dialog box when selection changes is that it breaks keyboard accessibility. The user uses the arrow keys to move through the combo box items, and when they get to the special one, a dialog box opens, even though their goal was not to select that special item; they were merely passing through.
What you can do is provide a separate button that opens the dialog box and show the button only when that special item is selected.
The customer didn’t say what the combo box item or dialog box was for. My guess is that the combo box provided a bunch of premade values, and a special item called Custom. If you select Custom, then they wanted to open a dialog box so you can select your custom value. For that case, an alternate design would be for the page to show a “Change custom value” button when Custom is selected and even show the current custom value next to it.
A combo box selection shouldn’t trigger a dialog box if you can help it, but it can legitimately cause an adjacent pane of controls to appear that were otherwise hidden. This kind of thing is completely easy in XAML where you can directly bind the visibility of the pane to the combo box value.
The “Custom…” option is (or was) often used in colour selector combo boxes; clicking it typically invokes (invoked) the Windows colour picker (modal) dialog.
Your proposed solution doesn’t seem ideal either.
seems ok accessibility-wise if selecting a list item shows a modeless dialog box displayed off to the side, non-overlapping, and non-focus stealing (or you could just add extra controls to the dialog, but that’s more programmer’s work).
2000/XP did this with the Browse item in find files. The keyboard navigation becomes slightly annoying but not a big deal.
Oh, how I hate all the dialog boxes that start to do anything before I click “apply”, “next”, “ok” or whatever button means I’m done with selection. But the examples of such behavior are just here, in Windows itself. In Win10 Display Settings dialog starts switching active displays, their orientation and resolution right after changing the value of comboboxes. And this is much more destructive than showing an extra dialog box. Accessibility? Didn’t hear
I would tend to disagree for this specific scenario. This is an efficiency thing. When you make changes to display settings the only way to know whether you'll like it (or if it works) is to see it. That is what the UI is doing. It is temporarily applying the changes so you can determine if this is what you want. If the UX required the user to click OK, Apply or whatever then the changes are now permanent, even if you didn't want them. There would be no way to easily get back to the previous values without adding...
So I need to see all the resolutions between the current one and the needed one in sequence if I change it with the keyboard? Remember that changing the display resolution takes time, causes the screen to go blank for a moment and some of the modes can be not working properly. This is exactly the scenario when I want to set everything up, double check and only then apply the settings. And bonus point: after changing the settings in this dialog you always get a confirmation dialog er... something that asks if the settings are good or should be...
Yeah, but these are “modern” UIs, not dialog boxes, where clicking anything should just immediately change this, no need to do ok/cancel/whatever.
It’s just that to many of those (me included) used to the ok/cancel idiom, and the rollback opportunity it provides, these new UIs are horrible half of the time.