react-select-event icon indicating copy to clipboard operation
react-select-event copied to clipboard

Cannot select same option for multiple dropdowns

Open ledenis opened this issue 2 years ago • 4 comments

It fails to select the same option when there is multiple dropdowns.

It seems that getReactSelectContainerFromInput goes to far in the ancestor tree. When trying to click on the option, it sees the text from the other dropdown.

ledenis avatar Dec 03 '22 13:12 ledenis

Note: I did not add a fix. I only added a failing test (inspired from https://github.com/romgain/react-select-event/pull/47 )

ledenis avatar Dec 03 '22 13:12 ledenis

Thanks a lot for reporting this @ledenis !

Would you be able to contribute a fix? Thank you!

romgain avatar Dec 03 '22 14:12 romgain

I was thinking about it, not sure if I can find a reliable fix. I saw that an attempt has been made to improve getReactSelectContainerFromInput but it caused bugs then reverted : https://github.com/romgain/react-select-event/pull/86

Meanwhile, I found a workaround: pass a custom container

    await selectEvent.select(mondayInput, "Chocolate", {
      container: () => mondayInput.closest('[class$="-container"]')!,
    });

A similar approach was found by someone else: https://stackoverflow.com/questions/70018351/react-select-event-doesnt-trigger-the-onchange-function-to-set-the-value-during

ledenis avatar Dec 03 '22 16:12 ledenis

I pushed a fix :tada:

ledenis avatar Dec 03 '22 22:12 ledenis