-
Notifications
You must be signed in to change notification settings - Fork 20
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
Restore accessible autocomplete component #2481
Conversation
cff859c
to
dd62a75
Compare
- this is the code for the previous version of the component, removed in #1038 - does not use the git branch or code for multiple selections, as this is not needed - otherwise unchanged and apparently functional, but some functionality here is not required and tests are failing
- finder-frontend had some very specific requirements for controlling the autocomplete outside of the component itself (facet tags) and this is not needed
dd62a75
to
c9e66e4
Compare
- also converts it to be a GOV.UK init module - and remove tracking code
ff6aeb6
to
b224821
Compare
13d9551
to
041f409
Compare
041f409
to
61d02c7
Compare
- make the code easier to read and more clearly separated into functions - adds a custom event listener for keyup, so that we can clear the hidden select if the autocomplete is cleared. This doesn't seem to work properly with the standard autocomplete - update tests to remove jQuery and fix the events so they stop failing intermittently
61d02c7
to
bd50892
Compare
I'm creating this with reservations - there's something of a disconnect between the autocomplete and the hidden The use of the autocomplete with a hidden select was chosen to make the non-JS version slightly more helpful for users than an empty input but I'm strongly considering changing this component to use a normal input and a datalist. |
Before reviewing the code, if it's only needed in one application (be that Update: as discussed, the component is used by other applications (content-data-admin and content-publisher) in different forms, so there may be scope in having it in the library. Note the content-publisher implementation uses a fork of the accessible-autocomplete. |
Thanks for the information @alex-ju. I'm still trying to decide how to proceed. I think my options are:
|
I'm sharing some thoughts on this, but you are closer to the problem than I am.
The autocomplete code itself has unit tests in the main repo, hence in
This approach has the advantage of being able to test and iterate quickly without needing to release a new version of the component. It can also be retired with much ease.
The work to converge/consolidate may fall between the cracks (as none the C19 or the Publishing team may be willing to take the time to do it). |
@alex-ju I've created a new component in |
What
Restores the accessible autocomplete component, with changes.
This uses the accessible autocomplete code to progressively enhance a select element. This is based on the accessible autocomplete component that existed briefly in the gem until we didn't need it anymore, but with some changes, specifically:
onConfirm
function (a customonConfirm
was originally included because we needed to externally control the component infinder-frontend
)onConfirm
seems to have a bug where it fires when the autocomplete is blurred, but passesundefined
even if something has been correctly entered in the autocomplete. An event listener has been added to the component to compensate for thisWhy
We're exploring using this component in a travel smart answer and it's currently the most suitable thing available.
Visual Changes