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

Opening dropdown via dropdown icon hijacks events (react-datepicker example) #5050

Closed
rkulinski opened this issue Feb 8, 2022 · 4 comments
Closed
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet

Comments

@rkulinski
Copy link
Contributor

rkulinski commented Feb 8, 2022

When using react-select with react-datepicker it seems that some architectural issue of react-select shows up.

Repro:
https://stackblitz.com/edit/react-o6gkep?file=src/App.js

Correct behaviour:

  1. Open datepicker.
  2. Click on select (not the part with icon on right) and observe datepicker is closed correctly.

Issue:

  1. Open datepicker.
  2. Click on the part with icon on right of select and observe datepicker is not closed.

I think there's a problem with how this div with icon is designed. Seems to me like it's highjacking events. That doesn't happen for other part of the select and IMO it shouldn't happen here as well.

It was reported here:
#1539
but closed without any resolution.

Versions:

    "react": "17.0.2",
    "react-datepicker": "4.6.0",
    "react-dom": "17.0.2",
    "react-select": "^5.2.2"
@rkulinski rkulinski added the issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet label Feb 8, 2022
@rkulinski rkulinski changed the title Opening dropdown via dropdown icon hijacks events Opening dropdown via dropdown icon hijacks events (react-datepicker example) Feb 8, 2022
@rkulinski
Copy link
Contributor Author

I think the issue is that dropdown indicator has it's own method for click (onDropdownIndicatorMouseDown). It calls stopPropagation which causes e.g. react-datepicker to not receive an event. I honestly don't understand why there are two handlers (with different logic inside) for something that seems should be working exactly the same.

@hushee69
Copy link

For information, the bug isn't reproductible in mobile view for some reason (used this https://stackblitz.com/edit/react-o6gkep?file=src/App.js while on mobile view and DatePicker does close correctly when select is clicked using the icon on right)

@rkulinski
Copy link
Contributor Author

rkulinski commented Mar 25, 2022

@hushee69 possibly because touch events are used.

@rkulinski
Copy link
Contributor Author

Will be fixed in #5138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/bug-unconfirmed Issues that describe a bug that hasn't been confirmed by a maintainer yet
Projects
None yet
Development

No branches or pull requests

2 participants