-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Opt-in for <select>
customizability
#5791
Comments
Bringing in my comment from the MSEdgeExplainer repo: From the beginning I've been in favor of having new elements for the new controls as it also allows us to keep some native ones and specific needs for certain capabilities (window escape, etc). As we discussed in our explainer I'm also a fan of the built-in parts, while maybe leveraging WC parts under the hood being elements themselves as well so it is 100% apparent what is standard/ships with the UA and what is user land code. |
What type of customizability are you trying to add to |
@Yay295 thanks for the question. While it's a bit long the explainer delves into the overall goal for every control that is currently shipping natively in browsers and exploration of new components/controls. TLDR; enable styling and extensibility of the built in controls by defining the antomy, states and behaviors within one specification within Open UI. Some additional reading on the topic of the problem space and why this is worth investing in (I have some other concrete examples that I provide in my Open UI talk but haven't put in blog form yet):
Open UI will define the necessary anatomy which may result in new elements or psuedo elements, states, and other gaps. So to scope this one, the specific request as @dandclark has noted is that in order to unlock these new capabilities as some authors may desire the current
As outlined in the explainer it makes sense to introduce new elements for the various input types since their models and controller code are so different and this will allow this fork in the code. Let me know if that clarifies it for ya @Yay295 |
If the main goal is styling I don't see why we need a new attribute or element. It seems that |
@annevk out of curiosity did you read the explainer? Currently the parts of a select (and many other controls) are not exposed in order to enable the necessary styling and extensibility. As I outlined to the CSSWG we continue to do this but in an ad-hoc fashion due to inteop (see the file input psuedo element request by Mozilla). Open UI is a place where we're doing a holistic review and creating functional specifications that defines a control/component for web plat, component libs, etc as everyone is duplicating these (a single standardized functional specification currently does not exist).
There will be a need for |
A new element makes a lot more sense to me. If you go that route, I would suggest trying to unify |
@gregwhitworth well yes, you would also need pseudo-elements to get at the various bits. It would not give you the ability to add new bits necessarily, but it would address a large swath of the use cases. (And yes, part of disabling the native theming would be disabling the dialog drawing its own window.) |
And this is why psuedo elements are insufficient to cover the use cases. The explainer outlines that we'll leverage web component definitions leveraging slots and updating the definition of part to not solely be a hoist for CSS but to denote (even though it's implied) that the part has "controller" code attached to it by the component author. This will allow the UA (or component lib that builds according to Open UI) to wire up the necessary events & ARIA. This enables general extensibility without needing to completely recreate every interaction that a control has which can be very complex and is often not done with the same rigor across all implementations.
Agreed
I am open to this and am worth discussing it, I'd like to resolve on the differences/naming as a combobox and select as the majority of component libs, etc leverage the name select even if they appear as a combobox. Which is why we were initially leaning towards a select derivative. |
The naming will be a hard problem regardless, as you've mentioned; I don't have any strong opinions there. But I do feel somewhat firmly that there needs to be unification of "select where you can type" and "select where you cannot type". And ideally that would be at the web-developer-facing level. For example, one element with an optional attribute. Stated in terms of use cases, I think developers transitioning from a fixed set of inputs to a fixed set of inputs + optional free-form text (e.g., modernizing a gender form field) should be able to do so easily. Currently, to transition from |
@domenic yep - there is agreement here generally and we've discussed this in general here in Open UI as this is the primary request for This is even more more odd with built in UA implementations as they allow type ahead functionality but don't show the actual user input which is just generally a bad UX. I think due to this I'd be more in favor of keeping the |
I just want to second this - the new element should unify these two use cases ("combo-box" and "drop-down") into a single control. And I want to re-iterate my original comment: I think this should be a new element, not an attribute (which can be added and removed) on
And inevitably there will be strange behaviors associated with adding or removing the opt-in attribute on Consider what would happen here, if we went the attribute-on-select route: Sample #1: const combobox = document.createElement('select');
document.body.appendChild(combobox);
combobox.addAttribute('newbehavior','true'); // Opt in!
combobox.innerHTML = '<option><img src="cat.jpg">Cat</option><option><img src="dog.jpg">Dog</option>';
// Here, we have a fancy, new <select> with images of cats and dogs Sample #2: const combobox = document.createElement('select');
document.body.appendChild(combobox);
combobox.innerHTML = '<option><img src="cat.jpg">Cat</option><option><img src="dog.jpg">Dog</option>';
combobox.addAttribute('newbehavior','true'); // Opt in, but a little late
// Boo! No images here, because we opted in after innerHTML, and the parser removed the <img> tags. |
(Note that |
I second the proposal for a new A few thoughts:
|
Related issue: #6733 |
Let's duplicate this into #9799. |
@dandclark opened this issue on the repo that contains the explainer for this. For context, we released an explainer that attempts to explain a web platform control definition for defining components going forward. This requires HTML modifications across the WHATWG but to keep this one scoped. Here is the outline from Dan in the initial issue:
The text was updated successfully, but these errors were encountered: