GavinJoyce / ember-headlessui

https://gavinjoyce.github.io/ember-headlessui/
Other
92 stars 34 forks source link

:bug: <listbox/> with transtion open on "enter" click #146

Closed far-fetched closed 2 years ago

far-fetched commented 2 years ago

What changed and why:

Currently when using <Listbox/> component with composition with <Transtion/> it is not possible to use "Enter" key to open listbox.

Video from demo (try yourself):

https://user-images.githubusercontent.com/11621383/170680518-49a03b85-e6c0-43d9-a1dd-b2b39e429278.mp4

Fix:

listbox with transition suffers from race condition. When “enter” click, handler for keyPress is called – is sets flag isOpen to true. Then after a while, the handler onButtonClick is also fired – this handler toggles isOpen property – so it reverts isOpen to false. Everything above is executed on one “enter” click.

link to failed test.

NullVoxPopuli commented 2 years ago

Thanks for doing this!!