accessible-autocomplete icon indicating copy to clipboard operation
accessible-autocomplete copied to clipboard

Add class to input when dropdown is active

Open AlecRust opened this issue 6 years ago • 3 comments

I'm working with inputs that have a border radius:

screenshot

And when the results are open I'd like to remove the bottom border radius from the input, to achieve:

screenshot

However, there doesn't seem to be a class on the input when the results panel is open for me to do this.

The aria-expanded attribute does change when the results panel has results, so I can do this:

.autocomplete__input[aria-expanded=true] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

But not when the panel is open for the "no results" message. So it only half works:

screenshot

This seems like a pretty common use case that could warrant adding a class for? Or perhaps aria-expanded should be set to true when the results panel is expanded showing "No results"?

AlecRust avatar Oct 09 '19 19:10 AlecRust

Hello @AlecRust ,

Thanks for raising this.

It seems like the aria-expanded state should be consistent when showing 'no results', but I would need to properly think this through and test this.

We're primarily focused on supporting users of government since we have limited time as a team.

If you want to contribute this fix you're welcome to raise a pull request and we can review it when we get the time, thanks for your patience. 👍

NickColley avatar Nov 06 '19 16:11 NickColley

+1 This would be super helpful. I'm having this same issue right now.

dilrajahdan avatar Mar 11 '20 10:03 dilrajahdan

I think it'd be helpful to add the class to .autocomplete__wrapper, so that other elements could be styled too.

iandunn avatar May 03 '23 15:05 iandunn