Hacker0x01 / react-datepicker

A simple and reusable datepicker component for React
https://reactdatepicker.com/
MIT License
8.12k stars 2.24k forks source link

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

Open gunavata opened 1 month ago

gunavata commented 1 month ago

Describe the bug When upgrading to version v7.4.0, react-onclickoutside has been removed as part of this release: https://github.com/Hacker0x01/react-datepicker/pull/4979

This however will reintroduce an old bug from here: https://github.com/Hacker0x01/react-datepicker/issues/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):

Smartphone (please complete the following information):

NA

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

DioEraclea commented 12 hours ago

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