openoakland / woeip

A platform for impacted communities to understand their local air quality and advocate for environmental justice.
https://woaq.org
MIT License
29 stars 16 forks source link

When I click on the currently-selected date on the datepicker, it behaves unexpectedly #437

Closed gsehrlich closed 2 years ago

gsehrlich commented 2 years ago

Describe the bug The datepicker clears the text field showing the selected date. The date doesn't change. When the datepicker is opened next, it opens to the current month instead of the month containing the previously selected date.

To Reproduce Steps to reproduce the behavior:

  1. Make sure you have uploaded at least one day of data.
  2. Go to the Maps page. The page should automatically switch to the most recent date with data and load it.
  3. Click on the datepicker to open it.
  4. Click on the currently selected date.
  5. The text field clears. The date is not changed.
  6. Click on the datepicker again. It should open to the current month rather than the month containing the previously-selected date (which is still loaded on the map).

Expected behavior When the current date is clicked, nothing happens.

Desktop (please complete the following information):

Additional context This behavior is a feature of semantic-ui-react-datepickers that can be disabled by setting clearOnSameDateClick={false}. That should be done, but that alone won't fix the issue—code needs to be added to disable the current date so that it can't be clicked at all. When I tried only changing clearOnSameDateClick={false} just now, clicking the current date clears the map for some reason.

Affected Components (For Developers) Map menu

Technical Resources (For Developers) https://www.npmjs.com/package/react-semantic-ui-datepickers