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

Calendar not clickable when wrapped with shadow-dom - Removal of react-onclickoutside reintroduces bug #5149

Open
gunavata opened this issue Oct 8, 2024 · 3 comments

Comments

@gunavata
Copy link

gunavata commented Oct 8, 2024

Describe the bug
When upgrading to version v7.4.0, react-onclickoutside has been removed as part of this release:
#4979

This however will reintroduce an old bug from here:
#1928

Specifically, when the datepicker is open, clicking anywhere, including trying to click the datepicker popup content's itself, will automatically close the datepicker pop up without registering the click.

To Reproduce
Steps to reproduce the behavior:

  1. Install version 7.4.0 of react-datepicker
  2. Create a shadow root component
  3. Insert a general Datepicker component with minimal setup i.e selected + onchange handler inside the shadow root component
  4. Open the datepicker by clicking it
  5. Attempt to click anything inside the datepicker popup (NOK -> will close the datepicker popup on a "mousedown" event)

Expected behavior
Datepicker pop up should not close on a mousedown event and should instead register the click appropriately.

Screenshots
Example datepicker:
image
Example render:
image
Example html:
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 129.0.6668.71 (Official Build) (32-bit)

Smartphone (please complete the following information):

NA

Additional context
Downgrading to v7.3.0, the datepicker works fine. Only present in v7.4.0

@gunavata gunavata changed the title Removal of react-onclickoutside reintroduces bug calender closing when wrapping with shadow-dom Calendar not clickable when wrapped with shadow-dom - Removal of react-onclickoutside reintroduces bug Oct 11, 2024
@DioEraclea
Copy link

DioEraclea commented Nov 27, 2024

Updated react-datepicker in our project to 7.5.0 and encountered the same issue.

@hamidrezahanafi
Copy link
Contributor

@gunavata I originally removed it because react-onclickoutside is not going to be compatible with React 19
If you can give me a reproduction example, I will take a look

@robmisasi
Copy link

robmisasi commented Dec 19, 2024

@hamidrezahanafi Here is a codesandbox reproducing this issue. I face this issue as well. The CSS is not applied under the shadowroot, but you can still attempt to click the buttons to show the behavior described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants