-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stylable select: What should we do about the multiple
and size
attributes?
#977
Comments
To reiterate, here are the modes I am proposing supporting:
<select>
<button>custom button</button>
<datalist>...</datalist>
</select>
<select>
<datalist>...</datalist>
</select>
<select>
<button>custom button</button>
<option>one</option>
...
</select>
<select size=n>
<datalist>...</datalist>
</select>
<select multiple>
<button>custom button</button>
<datalist>...</datalist>
</select>
<select multiple>
<datalist>...</datalist>
</select>
<select multiple>
<button>button</button>
<option>one</option>
...
</select>
<select multiple size=n>
<datalist>...</datalist>
</select> I wrote this out based on the idea of extending the existing multiple and size attributes because there was a question raised in whatwg concerning what we should do with these attributes when you're opting in to the new behavior by providing a button or datalist element. Alternatively, there could be some other way to opt in to making a custom+stylable in-page select or a custom+stylable multi-select, perhaps with an enumerated attribute that is put on the select element. I'd be curious to know what @smaug---- and @annevk think of this. |
@josepharhar -- in the existing (selectlist) implementation,
Is it confusing that this would not be possible now? I would expect the above to "just work" as it does in the current prototype. |
The problem with the above example is the existing parser restrictions. So we'd need an attribute or datalist to enable the new parsing model (for back compat). Or a new element obviously. |
Goodness that matrix hurts my head and trying to explain this in any meaningful sense to devs. But let's set that aside for now. I'll break this up and address sizeCan I ask an honest question, if For this example, let's assume that in order to have standardized styles we need to use the proposed HTML
CSS
As we discussed prior; the datalist will be We could have an alias for multiple
This is my largest concern. I fear that we're going to rush this and put in While the easy path is to simply say to add in a place for |
@josepharhar I don't think "native" vs "custom" should follow from markup. It should follow from CSS. There might well be limits to a "native" appearance, forcing a user agent to fallback to text or text and images, but that seems acceptable. If a developer wants full control over the appearance they can use |
Sounds good to me, apologies for this or any future word choice to suggest otherwise.
As Luke said, this can't work given the restrictions of the HTML parser. If we are going to reuse the select element, which it seems we must, then we can't make this work without making a large breaking change to websites.
I don't think we can make datalist work as a standalone in-page listbox because it is currently always display:none. I suppose that we could add an attribute or something to it to opt into an in-page listbox thing, but if we also want to give it form semantics and stuff as a form-associated element then we would be better off reusing the select element I think. I agree that size is kind of weird but I think its the most natural way to provide the in-page listbox that people were hoping that the
Yeah that could also work if there are no quirks. Maybe you could try it out soon when I finish the prototype in chromium.
Yeah that doesn't sound bad to me. Using a completely new attribute also reduces compatibility issues when we change the behavior of size or multiple in the future. I was just talking to @mfreed7 about how to make multiple work in the future, and if we ship single-select improvements before multi-select improvements then we need to provide some way to feature detect what state the improvements are in, and using completely separate attributes would be an easy way to do that. |
I could see offering a replacement for |
Sounds good to me. Greg's suggestion of creating a new "inline" attribute sounds appealing to me
Could you elaborate? Should we make the getter return false if you are opted in to the new behavior but we havent implemented support for multiple yet? |
For feature detection of support for multiple, what about if the presence of the function supportsMultiple() {
const select = document.createElement('select');
select.multiple = true;
select.innerHTML = '<datalist><option>';
return select.firstChild.localName === 'datalist';
} |
The Open UI Community Group just discussed
The full IRC log of that discussion<una> SGTM ^<dbaron> ScribeNick: luke <brecht_dr> jarhar: There are some questions risen about multiple and size. Let's just integrate this when doing the stylable select <gregwhitworth> q+ <brecht_dr> jarhar: I layed out a few cases on how we could do that. Maybe we should not do something with size, and keep the multiple <scotto> q+ <brecht_dr> jarhar: maybe we need a replacement for size, but we need an answer how the single select will work to work on the multi-select in the future <masonf> q+ <dbaron> s/ScribeNick: luke/ScribeNick: brecht_dr/ <brecht_dr> gregwhitworth: what i am curious about: we want to ship this soon. With the new element we could use multiple. How do we ensure that the multiselect is backwards compatible <brecht_dr> gregwhitworth: do we need the multiple to ship the single select <brecht_dr> jarhar: no <luke> q+ <brecht_dr> gregwhitworth: will we ship the stylable select with multiple and just pass the issue to a later date <gregwhitworth> ack gregwhitworth <brecht_dr> masonf: I agree we need to built this in a way to ship the single select first and multiple later <brecht_dr> masonf: I like the multiple attribute, because people know it <brecht_dr> masonf: for now we could render the old behavor when multiple is added as an attribute <gregwhitworth> ack masonf <gregwhitworth> ack scotto <brecht_dr> masonf: so would be good to have a plan to ship single select first <brecht_dr> scotto: Do we need to do anything with size? The primary point of this is people willing to style selects <gregwhitworth> q+ <brecht_dr> scotto: It might be a good idea that you see a basic multiple select until it is shipped, this sound like a good reason to do this <brecht_dr> jarhar: +1 this <brecht_dr> masonf: The basic multiple looks aweful, and that's perfect, because it will still work. eventhough it's not a good looking element <brecht_dr> scotto: give them the old aweful until multiple stylable select is implemented sounds good <gregwhitworth> ack luke <gregwhitworth> scribenick: gregwhitworth <gregwhitworth> luke: if we go on the basis of the new parsing model and there is a dl or not a dl then you use the old/new behavior <gregwhitworth> luke: it will use the options not within the datalist and they add multiple they will get thrown away <jarhar> q+ <gregwhitworth> luke: if that's the case then it breaks obviously to the dev, I like that it's perfect <gregwhitworth> masonf: it would actually go back to the old solution and so datalist wouldn't be in the DOM <jarhar> the parser will still allow datalist in select multiple, but it might not be rendered because the old code expects the options to be direct children maybe - not sure but will have to look <gregwhitworth> luke: the size attribute to have in page listboxes, having them inline is useful and common components and you can choose between two groups <jarhar> having an in page listbox is something id like to support since people want it, but not sure if size is the right way to do it - maybe a new attribute like inline like greg mentioned would be cool. size attribute could just render the old thing <gregwhitworth> luke: I think it's something worth doing in the future but I like size opting out of the old model <gregwhitworth> scribenick: brecht_dr <brecht_dr> gregwhitworth: I love the blowouts of the old parser approach. In the past, size was a way to change styles which you can do with css now with the popover <brecht_dr> gregwhitworth: I think we should solve multiple, I like not taking forward size <jarhar> i think we should still provide an explicit inline thing, but maybe not with the size attribute <gregwhitworth> q? <gregwhitworth> ack gregwhitworth <gregwhitworth> ack jarhar <brecht_dr> gregwhitworth: Personally, i wouldn't miss size <brecht_dr> jarhar: Not sure if putting display block on the datalist is the way to go. Ideally with size we could just still render the old thing. <brecht_dr> jarhar: for select multiple and you put datalist in it. I think the browser will still alow it, but if it will render the old view because we haven't implement it, i'm not completely sure <masonf> q+ <gregwhitworth> Proposed Resolution: Re-use the multiple attribute for multi-select in the future and for now we render the current solution when it's present. For size we'll plan on creating a new attribute to produce an inline select but for now we'll leverage the current solution <gregwhitworth> ack masonf <gregwhitworth> q+ <scotto> q+ <brecht_dr> masonf: If having a multiple attribute on there triggers the parser to show the old way, sound better <brecht_dr> jarhar: We're not doing new stuff for multiple yet, and this would force people not to use it and have a fallback <brecht_dr> masonf: it should be a feature detect <brecht_dr> gregwhitworth: I agree with going back to the old skool one. <gregwhitworth> ack scotto <gregwhitworth> ack gregwhitworth <brecht_dr> gregwhitworth: It becomes obvious that this isn't supported and that's a good thing, seeing an old styling for size <brecht_dr> gregwhitworth: for size attribute - see a broken select * <brecht_dr> scotto: I agree with this <gregwhitworth> Proposed Resolution: multiple and size will not be supported initially on singled select with datalist. If these attributes are detected the parser uses the original select logic <flackr> q+ <luke> +1 <gregwhitworth> ack flackr <masonf> q+ <brecht_dr> flackr: What does the feature detection look like? <brecht_dr> masonf: I added an example in the issue <gregwhitworth> ack masonf <brecht_dr> flackr: might be better ways to feature detect, but we can think about that later on <brecht_dr> masonf: I'm curious if we might ship support for a new version of size early on <brecht_dr> masonf: I'd like to split that in a different issue after resolving on this <brecht_dr> +1 <masonf> +1 to the resolution <luke> +1 <gregwhitworth> Resolved: multiple and size will not be supported initially on singled select with datalist. If these attributes are detected the parser uses the original select logic <masonf> RESOLVED: multiple and size will not be supported initially on singled select with datalist. If these attributes are detected the parser uses the original select logic <gregwhitworth> Zakim, end topic <Zakim> I don't understand 'end topic', gregwhitworth <gregwhitworth> Zakim, end meeting |
This follow the resolution in openui#977
Making the parser dependent upon attributes won't gain multi-implementer interest I'd bet. It's also better for downstream HTML parsers if we can do all the parser changes once instead of spreading them out. And yeah, I meant that the |
Thanks - but can you say a bit more here? The
Makes total sense, I think.
Ok, that can work too, and that makes the feature detection easy: |
* Add size and multiple to select explainer This follow the resolution in #977 * add space
There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label. |
Since we are committed to doing a CSS solution for the customizable select project, the answer here is simple: |
It's prolly cleaner to not support |
The stylable select element as we are designing it right now is only for single-select with a popup listbox.
In the future, it would be great if we could extend these improvements to
<select multiple>
and<select size>
. Here are my initial ideas:<button>
as a child of a<select multiple>
makes it replace the button to open the popup, and on desktop, makes it have a popup insead of the current in-page listbox thing.<datalist>
as a child of a<select multiple>
replaces the listbox, but makes it also have checkboxes in or next to the<option>
s somehow.<datalist>
and a<button>
to a<select multiple>
makes it have a custom button to open the popup and lets you replace the contents of the listbox, like a combination of the last two options.<datalist>
to a<select size>
would replace the in-page listbox and keep it in-page without a button. If we end up using<datalist>
for all this stuff instead of creating a<listbox>
element, this could be a way to effectively get the<listbox>
accessibility primitive that people have been asking me for. Putting a<button>
inside a<select size>
would not do anything, but would still be allowed by the parser. The value of thesize
attribute would likely not perfectly map to the number of options displayed in the height of the element due to layout issues.In the initial version of single-select with a popup listbox,
<select multiple>
and<select size>
would continue to render the same way as they already do.@smaug---- I think that we can design and ship these things separately/iteratively. Do you agree?
@pxlcoder do you have any thoughts?
The text was updated successfully, but these errors were encountered: