Open klonos opened 8 years ago
You are very right.
Is this a duplicate of #1442 ?
Hmmm 🤔 ...it's been some time now, but I believe that #1442 was raised specifically for the widget dropdown menus in the Manage fields form for content types; whereas this one here is to implement it globally, in the Form API level.
In that case, I think if it's decided that Backdrop core UI wants to do this in #1442 then that's fine, but to do it in the Form API, that'll affect contrib modules and people's custom code/forms, and I don't think we should make that assumption for people...
I see the point in what you are saying @BWPanda, but there is no merit in having this be an option/select, when there is only a single option to select from - only the added click (multiple clicks if many such selects in a single page), and the added UX WTF.
Consider this similar to the situation where you have multiple radios instead. If certain options are not available, then there is no need to specifically render them (unless disabled/locked). If in the end you are left with a single radio option, what is the point of rendering it as a radio? (see #1837).
there is no merit in having this be an option/select, when there is only a single option to select from
I'd say 'consistency' - not changing the way a form element works/looks based on the number of available options...
I think we should respect developers choice. If they choose a select list for an element, that's what they should get. If they have a single option and want a markup element, they can choose that.
But I also see what you're saying when elements are dynamic and the number of options change. So maybe a better solution would be to provide a new form element that does what you propose. Or, at the very least, have a setting on select elements to allow changing it when there's only one option (but this should be disabled by default).
As a developer, instead of rendering single-option selects as plain text, would you find it acceptable to be rendering them as disabled/locked? That would keep them as the same element, and at the same time prevent the click-with-no-reason UX WTF for end users.
...or would you still find that behavior "disruptive" in some way?
As a developer, if I create a form element using the Form API, either:
Fair enough.
...one such "thingy" is the "Widget" options drop-down menu in the "manage fields" page of content types. Here's an example when the field type is "link":
I'm not sure if it is possible to do this on a global level, but it would be a big UX+ if we could.
Rationale: as a new user, whenever I see a drop-down, I expect various options/choices to be available when I click it. When I see only a single option instead, my first thought is "there goes a wasted click". Having to do this a number of times throughout the entire UI makes things worse.