gpbl / react-day-picker

DayPicker is a customizable date picker component for React. Add date pickers, calendars, and date inputs to your web applications.

Home Page:https://daypicker.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Safari/iOS: hover background when unselecting a day

jasondainter opened this issue · comments

Description

When selecting the day of the month, then unselecting in a mobile browser (tested in chrome on IOS) it goes from

Selected...

IMG_4770

To Unselected (pressing the date again)

IMG_4769

But as you can see (this was tested via the demo on https://react-day-picker.js.org/start directly) you get this blue highlight remaining

Screenshot 2024-03-01 at 14 33 38

This is quite confusing UX as you would expect no selection at all (it looks like it is still selected when it isnt)

Seems fine on Desktop.

Is there any way to turn that off?

Expected Behavior

Expect the lighter blue circle to dissapear

Actual Behavior

Lighter blue circle remains after clearing selection.

Steps to Reproduce

  1. Step one - https://react-day-picker.js.org/start
  2. Step two - Press a date on mobile (ios/chrome)
  3. Step three - Unpress a date (unselect)

Your Environment

  • React version: 18.2.0
  • Browser [e.g. chrome, safari]: Chrome
  • Version [e.g. 22]: Chrome 122
  • Operating System [e.g. iOS, Windows]: iOS 17.3

@jasondainter I see it. It looks like Safari is keeping the :hover style. It seems to be an issue for other people too: https://stackoverflow.com/questions/47802530.

Screenshot 2024-03-02 at 6 40 30 AM

Looks like the fix is to include the over style inside @media (hover: hover) {.

Thanks for quick feedback. in the end I disabled the hover entirely. In my case todays date is highlighted (selected) when the user sees the calendar so I probably get away with this more (eg its more obvious the user has to click a date). would be great to have this fixed in a future version if doable!

Closing this as we are removing the hover effect in v9: see https://react-day-picker.js.org/next/using-daypicker/styling