-
-
Notifications
You must be signed in to change notification settings - Fork 840
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Combobox / autocomplete #127
Comments
FWIW, I've done a fair amount of work on a pure web-components implementation here: https://github.com/claytongulick/chip-input it might be a good starting point / base for implementation? |
@claytongulick This looks pretty cool! I'll try it out =) |
Argh, I need |
It has begun! https://codepen.io/jaredcwhite/pen/LYbmwgz Haven't gotten to autocomplete/dropdown yet, but the tag input works pretty well. =) (type in anything and hit enter. clearing works too. @claviska Having fun with Shoemaker so far! |
@jaredcwhite great start! There are a ton of little details you'll have to think about, async autocomplete so you can call out to an API, formatting in autocomplete, positioning the dropdown, styling the widgets/pills, carrying data - having a display value vs linked object value, consumable events, etc... Feel free to browse that chip-input code to see some of what I'm talking about, lift as much from it as you can :D |
Any updates on this @jaredcwhite? I would really like to have an autocomplete in my project. right now, I'm doing some hackery with the |
@sidharthramesh Well I'm not sure if my hackery is any better than your hackery, but here's what I've got so far! https://github.com/whitefusionhq/sl-tags-input I went ahead and published it because I need to use it in a project. Likely needs some more detailed API design and accessibility fixes, but it's working now for my needs. I can type, pull related results in from an external data source, and pick one, or type in one manually and hit enter. Add/delete tags. etc. |
Very cool! I'll take a look |
@jaredcwhite did you have this issue #382 (down arrow not working properly) while using a drop-down element inside lit-element? |
You know, actually I did. That's why I ended up making SLMenu a slotted element in the Light DOM. If the bug gets fixed I might be able to simplify and move it into the Shadow DOM template. |
Any idea why the behaviour is different when using the same markup inside lit-html? This is unsettling because I'm using lit-element everywhere to wrap shoelace components into more general building blocks for my use case. Is it something to do with the shadow dom? |
@jaredcwhite @sidharthramesh this was fixed in 20eff47 and will be available in beta.35. |
I can create a nice search bar, if the dropdown element had some additional props. I have made these changes here #385 |
I’m renaming this to align with the W3’s definition: https://www.w3.org/TR/2021/NOTE-wai-aria-practices-1.2-20211129/examples/combobox/combobox-autocomplete-list.html For accessibility reasons, I think the scope should be more or less limited to what’s described here. |
@claviska, |
Sorry about that...things change quick sometimes, especially during beta. It's usually a good idea to limit one branch to one feature for that reason. I hope it doesn't create too much work for you! |
hey guys, what is the consensus on this topic now? The PR from @hanc2006 seems to be kinda stale. |
Sorry, no update from my end. I'm focusing on other things that need to be done before removing the beta label. |
I put some effort in a similar component, feel free to steal some code of this; |
@luwes Looks good in the demo! |
I tried to set up a combobox with Unfortunately, both have serious issues with keyboard event handling. https://svelte.dev/repl/a6f8e1e48a494a9eabbe7d879f0fbde6?version=3.48.0 |
Some thoughts:
|
I have made this component for my own needs, in case anyone is interested: Screen.Recording.2022-07-29.at.12.00.09.AM.movI can send a PR as a starter and discuss the API if there is enough demand. |
It’s a makeshift script that doesn’t work properly with screen readers. I fixed that problem in Doxicity, but I haven’t had a chance to rebuild the whole website yet. It’s even more of a challenge to get it right when composing a combobox with custom elements. Not impossible, but not exactly simple. |
Just thought I'd pipe in and call for some overall vision planning here. In my experience, I've run into many variations of dropdowns/selects and they all share common elements, but are necessary for different scenarios. Pretty much all of these components are needed on a modern app so IMO a standard component library should support all of these use cases. Here's the notes I've made over the years: Selection DropdownSelect one item from a short list. Action DropdownA short list of actions to take. AutosuggestPeople call this autosuggest, but it's really a select dropdown where you can search the list of options. Long Action DropdownLess common, but sometimes you have a really long list of actions you can take and the ability to search them is nice. Not planning to support this use case would be understandable, but I have seen it before… Multi-SelectA dropdown that lets you select multiple items. The selections are shown as pills or chips or something. You can click them to deseletc. Long Multi-SelectSame as Multi-Select but lets you search to select. Also similar to autosuggest, just allows selecting multiple things. Another potential use case that I've never seen is selecting multiple actions and then selecting multiple actions from a long list with search. The difference between an action and selection categories is that the anchor or trigger component doesn't change where with select the anchor shows the current selection(s). So the variables for the dropdowns I've needed over the years are:
Things these all have in common are:
I was king of thinking it might be a good idea for Shoelace to come up with a long term plan for how these things could fit into the offering. Whether thats as a single component or a few components, I think it'd be helpful to think ahead so that interfaces and code can be written with the long term plan in mind. I'm very willing to contribute and start to implement once you/we have that plan. You could make it all one component with options, you could make 2-3 components that use shared components common between them, etc. But I do feel strongly that all of these components are needed in most modern apps of even moderate complexity. Thanks for reading :) |
I experimented a little on the sample provided by @nileshtrivedi Here's an extract from my project's source code: https://studio.webcomponents.dev/edit/3WC1qIWWF6aSTPA6ASKK/src/index.js?p=website I think I got it fairly usable with two simple tweaks:
|
I have sent #1002 as a starter. While this is still missing a lot of things, you should all be able to give it a try on https://shoelace-git-fork-yuki24-combobox-component-shoelace.vercel.app/components/autocomplete. Would love any feedback on that. Thank you! |
Looks good. I think it just needs to auto drop down on click in. |
I guess the difference between an auto-complete input and a select control, apart from the visual aspects, is that an auto-complete will allow text that is not one of the suggested options. Not sure this needs to be a separate element? Perhaps could be a property of sl-input? However it is implemented this would be a welcome addition, as there is no current way to give the user suggested input in Shoelace it seems? |
Accessibility remains the biggest hurdle, as we want to allow options to be defined declaratively but we can't link ids across shadow boundaries. It's not impossible, but it's definitely not trivial with the tools we currently have available. |
Any progress on this? I like the idea of just augmenting the sl-input component to support this, e.g. via an |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Is your feature request related to a problem? Please describe.
I'm looking for incremental search for tags input.
Describe the solution you'd like
For inspiration, autocomplete in Evergreen and Fluent UI.
Describe alternatives you've considered
https://shoelace.style/components/select?id=help-text seems to focus on the option that starts with the typed character, but the search appears to stop there.
The text was updated successfully, but these errors were encountered: