rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.27k stars 180 forks source link

Indicator cannot rotate back to default after item selected due to focus #432

Closed bewards closed 2 years ago

bewards commented 2 years ago

REPL: https://svelte.dev/repl/c7d90b1645d44499b4bb25ff3d3a0808?version=3.20.1

Issue On focus of the dropdown, I am able to rotate the indicator, but once an item is selected and the list is closed, the indicator does not rotate back due to the focused CSS class not being removed. I think the intent of this focused class doesn't work for my required behavior. I can solve the issue by binding to the listOpen prop, but I have way too many dropdowns to do this for and the code would be redundant.

Possible Solution Use the listOpen property internally to toggle a new css class "listOpen" on the list container (selectContainer) so that it can be used to determine when the indicator should be in the up or down position.

rob-balfre commented 2 years ago

@bewards v5 has this already

https://svelte.dev/repl/f2afdec4a7de43e0a62446d2274c9049?version=3.49.0

If you have any pain points upgrading let me know. Thanks.