I do not really understand what is the problem with flexible <select> implementation in browser.
In my Sciter[1] the following are supported ( see screenshot [2] ):
<select type="dropdown"> - select with popup
<select type="list"> - select list
<select type="tree"> - hierarchical select (a.k.a. tree view)
and all of them may have
<select multiple> - multi-select, value = array[]
<select multiple="checkmarks"> - multi-select, value = array[]
select type="tree" may have also
<select type="tree" treelines> - draw treelines
<select> and <option>'s may have arbitrary markup inside (<hr>,<img>, whatever), even more any DOM element may have role="option" defined making it a selectable option :
> I do not really understand what is the problem with flexible <select> implementation in browser.
There isn't a problem. Your flexibility is just in the wrong place—the flexibility is on the side of the user and user agent, e.g. to manifest and interact with a "<select multiple>" input method however best for the device that the user is looking at the form with. The fact that it's not actually codified anywhere exactly how "<select multiple>" should work is a good thing. Your approach does away with that.
At least some of this is hopefully on the horizon with the stylable select initiative (this was previously called "selectlist" but they seem to have pivoted to alter/enhance the select element instead):
i built one a bit ago using an event (onselect or onchange?) handler on a regular dropdown that, when you click on an item, the handler removes that element from the dropdown options, and adds it to another ul/li list under the dropdown, with a little X to reverse the process
select2 does something similar but yea it's weird this isn't a built-in
TFA mentions `optgroup` too, wouldn't it make more sense to use that and style it similarly? Especially if `hr`-in-`select` is only going to work in Safari anyway(?).
<select multiple> on mobile devices is so good - why don't the finally improve the implementations on the desktop as well?
The arcane 90s UI paradigm it currently uses everywhere just doesn't work.
And please, just give us an attribute that adds a search bar... I don't want to use 30 KB of JavaScript just to have selects that feel like they're from this millennium, especially since those then don't work too well on mobile…
Agreed, this just looks like a non-accessible <optgroup> alternative and feels like a step backwards. I fear authors will now use hr instead of properly grouping their elements, to the detriment of screen reader users.
Why not just make horizontal rules between optgroups the default?
Sadly, this is all academic because in all commercial work, “designers” demand that you reimplement SELECTs to make them look a very, very specific way “consistently across every OS, for our branding’s sake,” leading to devs implementing them as a soup of 42 nested DIVs, an SVG or two, and 12 event handlers, and they still don’t act right when the dropdown doesn’t have enough space below it in the viewport.
It's always been there, but for traditional browsers, it was tedious: Ctrl/Cmd + click. Many non-power users found it tricky or didn't know about it, so we all more or less settled on checkboxes as a UX standard.
What's the reasoning for allowing select to have hr children but not optgroup? It doesn't seem like it would be any more problematic but I imagine I'm missing some relevant issue.
> You could still see it by manipulating the DOM or using XML, but apart from a couple of experts nobody knew.
Except for all the users who were frustrated by the change. Most users wouldn’t even know who to report this to, even if they noticed it at all. They may chalk up the issue to the new computer or phone they purchased in the last two decades.
For me the problem is that iOS already adds horizontal rules between all select options, so the new feature doesn't make any sense there, and I can't share code between Mac and iOS.
I wonder if anyone on the WebKit team looked at the blog post example in Mobile Safari?
Are you under the mistaken impression that this feature is already implemented in mobile Safari on iOS 17.3? It isn’t.
On iOS 17.4, you’ll be able to see that the divider is thicker and obvious. Long-press on the Safari address bar for an illustrative example. See the gap between “Voice Search” and “Move to Tab Group”?
> Are you under the mistaken impression that this feature is already implemented in mobile Safari on iOS 17.3?
The blog post didn't mention iOS at all. I'm glad to hear that the feature is coming in the future, though it's strange that the blog post didn't mention it, and also strange that they didn't implement it in 17.0 at the same time as desktop.
In my Sciter[1] the following are supported ( see screenshot [2] ):
and all of them may have select type="tree" may have also <select> and <option>'s may have arbitrary markup inside (<hr>,<img>, whatever), even more any DOM element may have role="option" defined making it a selectable option : And as a bonus, by declaring different flows in CSS in list you may have: [1] https://sciter.com [2] https://sciter.com/wp-content/uploads/2024/01/select-variant...There isn't a problem. Your flexibility is just in the wrong place—the flexibility is on the side of the user and user agent, e.g. to manifest and interact with a "<select multiple>" input method however best for the device that the user is looking at the form with. The fact that it's not actually codified anywhere exactly how "<select multiple>" should work is a good thing. Your approach does away with that.
https://open-ui.org/components/selectlist/
select2 does something similar but yea it's weird this isn't a built-in
maybe a dropdown with checklists?
That's builtin with <select multiple> but it's only usable on mobile.
[0] https://html.spec.whatwg.org/multipage/form-elements.html#th... (see the "Content model" line)
Deleted Comment
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/se...
For those without iOS, see an example here: https://ibb.co/DkN16Gc
And please, just give us an attribute that adds a search bar... I don't want to use 30 KB of JavaScript just to have selects that feel like they're from this millennium, especially since those then don't work too well on mobile…
On desktop (Chrome on Mac) each optgroup label is just a disabled item, and then its options are indented menu items below it.
It looks totally hacky -- the name of a group shouldn't seem like "disabled" option, nor are indentations in menu items an established convention.
That sheet on iOS is perfectly intuitive, however.
[1] Link to page section with demo: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/se...
Why not just make horizontal rules between optgroups the default?
https://caniuse.com/mdn-html_elements_select_multiple
https://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1....
Except for all the users who were frustrated by the change. Most users wouldn’t even know who to report this to, even if they noticed it at all. They may chalk up the issue to the new computer or phone they purchased in the last two decades.
I wonder if anyone on the WebKit team looked at the blog post example in Mobile Safari?
On iOS 17.4, you’ll be able to see that the divider is thicker and obvious. Long-press on the Safari address bar for an illustrative example. See the gap between “Voice Search” and “Move to Tab Group”?
The blog post didn't mention iOS at all. I'm glad to hear that the feature is coming in the future, though it's strange that the blog post didn't mention it, and also strange that they didn't implement it in 17.0 at the same time as desktop.