Skip to content
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

Make autocomplete arrow button work #2929

Merged
merged 1 commit into from
Jun 5, 2024
Merged

Conversation

yndajas
Copy link
Member

@yndajas yndajas commented Jun 5, 2024

Trello

There's an ongoing issue with the accessible autocomplete that stops the arrow from opening the options menu when showAllValues: true is enabled. The showAllValues: true option shows all values when focused on the autocomplete element without having typed anything. This somewhat fixes the behaviour in Signon

Screen recording

Current behaviour

Screen.Recording.2024-06-05.at.15.21.52.mov

New behaviour

Screen.Recording.2024-06-05.at.15.21.19.mov

This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

There's an [ongoing issue][1] with the accessible autocomplete that
stops the arrow from opening the options menu when `showAllValues: true`
is enabled. The `showAllValues: true` option shows all values when
focused on the autocomplete element without having typed anything

I tried getting this to work in Capybara with Selenium in
`granting_permissions_test.rb` and `account_applications_test.rb`, but
the click event listener on the arrow is making it a challenge to
click on it in a test. Per the Jasmine test, you need to dispatch a
click event rather than just using the `click()` method directly. I
tried doing this in the Capybara test with `execute_script` and various
other methods, but couldn't get the right results

Instead, I've opted for a small single function Jasmine test

This also hides the arrow when the autocomplete input is focused.
Initially I wanted to make the arrow stay but have it toggle the menu,
but I was trying to do this by checking whether the input was the active
element, and it's no longer the active element once you click on the
arrow! I didn't want to get into storing state in a variable, as there's
too much under the hood autocomplete functionality that would affect
visibility and therefore make the conditional logic complicated

[1]: alphagov/accessible-autocomplete#202
@yndajas yndajas force-pushed the make-autocomplete-arrow-work branch from 7b98a31 to fc1bda3 Compare June 5, 2024 14:28
Base automatically changed from improve-rake-task-logging to main June 5, 2024 14:44
@yndajas yndajas merged commit 1221307 into main Jun 5, 2024
15 checks passed
@yndajas yndajas deleted the make-autocomplete-arrow-work branch June 5, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants