-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
Autocomplete Complete #1045
Autocomplete Complete #1045
Conversation
Component created, route added to `links.ts`, route created in `routes`. Still need to create autocomplete.css, or some kind of styles file based on what Chris and the others think is best.
Update autocomplete names to be `Autocomplete` moved it down in the list so its in alphabetical order.
Updated filterValues() to use the `mode` prop to give the user some addition filtering capabilities. The `exclude` filter needs more work. Havign trouble figuring out the best way return a list of items not in the input.
Mode type added with values `exclude` and `fuzzy` this will give the user the options to only pick `exclude` or `fuzzy` when passing a value to the `mode` prop
…o feat/autocomplete
Updated types for list values so they are more module, instead of forcing `label, and value` keys. Added attributes for allowing `autoComplete` action to work. Created autocomplete action
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
What worked for me (in my interim implementation until this is released) was clearing the input when it's clicked, and selecting the text in the input on keyboard focus. I've considered adding a listener for Command + Z to put the last selected value back. MUI doesn't consider a filter to be active when you've clicked an option and go back on the input |
Hey Brent, so what you had was great. A lot of the core concepts are perfect. There's just some odds and ends that didn't quite align with how I was expecting this to work. Given the number of changes I hope you don't mind me committing these alterations direction. Sometimes it's just easier to show than tell! I've noted everything in detail below. You should be able to pull the changes down and review locally. HTML/CSS
Logic
Remaining Tasks
Feel free to ping me on Discord if you want to discuss this in detail. I'm also down to jump on a quick Zoom call if that's easier! But let me know what you think about this direction. I think it offers a ton of flexibility without trying to reinvent the wheel where we don't need to. |
I’m interested to hear why the choice of a The I'm getting really excited watching this PR come together, great job! RPReplay_Final1677620457.mp4In the video below, I use the arrow keys, but would not be able to select Screen.Recording.2023-02-28.at.21.47.39.mp4 |
The idea here is the autocomplete is a supplementary UI, not the form state itself. The choice in Select is primarily for presentation and a11y benefits that comes from native inputs.
Hmm, not a fan of how that's handled on your mobile device. That's really frustrating. I can't tell from the UI, is that an iPad or Android tablet? If it's the latter, which browser? |
iPad. Also looks a little janky, but better on desktop safari. I think this is just an annoying limitation webkit imposes (again). Other UI libraries seem not to use a |
Yeah the UI presentation is the simplest part of all this, so honestly if this is an issue we can change that out. The more important bit is that the data mapping and filtering logic are working as intended. |
Whitelist now is checked on each key value pair, compared to the entire array of objects stringified. Aria labels implemented (I imagine there are somethings wrong here)
@endigo9740 Another draft update!
As we discussed, I changed the select back to a div as we were experience issues with the default way select elements acted. With that change, I have added what I think should be the correct Remaining
After this review, assuming everything is okay- These items should be able to be started! |
Something really tiny, but I think you've misunderstood how tabindex works. 0 and -1 are the only values you'll typically need to use. Setting it to 0 adds the element to the tab index, making it possible to tab focus the element in the order it appears in the DOM. https://www.a11yproject.com/posts/how-to-use-the-tabindex-attribute/ |
Ah yes, thank you! I will get that fixed real quick! |
Assigned tabindex -1 based off the linked article, since it part of the combo box
@JustBarnt I've done another pass through this. So a few things here:
Additionally I've found another bug. Currently if you search for I'll leave that to you to try and track down and resolve. Also just general rule of thumb - no need commenting things for preserving the history, that's what version control is for. If you're not using something, just remove it! If something is temporarily disabled though, comments are fine (ala the popup) |
@endigo9740 I know exactly why that's happening- to me its a bug, as I would not expect to get
This is why, I'm checking if the sub-string of characters in value is equal to input, so But, I can remove that if in this case then. Haha |
@endigo9740 Completed the first draft of doc writing. Looking forward to your critique as I'd like to improve my technical writing.
QuestionsI noticed a couple of things I have questions on.
|
Width of the demo input needs to be adjusted to be responsive for mobile devices |
…creating an array instead using Object.values to create the array
With the latest changes @JustBarnt and I have agreed this is ready to merge. Great job Brent! Just in case anyone else is wondering, we WILL be pairing this with the Popup feature, but we need some adjustments to the action's trigger events and focus before this will work properly. We'll then also aim to improve the keyboard interaction. |
Before submitting the PR:
npm run test
?branch -m new-branch-name
What does your PR address?
Still a work in progress.
Below are items that I have progress or completion on.
Autocomplete
filteredValues()
.item
to.autocomplete-item
autoComplete
action that controls the show/hiding of the list itemsPopup.ts
)TODO
@endigo9740 If you get a quick chance to look at this- its much appreciated. I just want to make sure
filterValues()
is working more inline with what you were describing above.Mainly the
excludes
filtering is what I am calling it: My interpretation is if the user has an array of values, uses theexcludes
filtering and they search foo, the popup below the input would update and show the user "bar and fizz" because foo is already typed in the input.Excludes Example
IF I'm correct in that functionality I need some help figuring out how to keep removing from the list as they type. I was thinking would allow or allow users to specify
separators
to indicate when to search for a new string?