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

Commits on Jun 5, 2024

  1. Make autocomplete arrow button work

    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 committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    fc1bda3 View commit details
    Browse the repository at this point in the history