Vuepic / vue-datepicker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
1.48k stars 147 forks source link

Changed debounce on month-change-on-scroll to a variable rate throttle #725

Closed phillanier closed 9 months ago

phillanier commented 9 months ago

This is an improved implementation of the issue that was resolved here: https://github.com/Vuepic/vue-datepicker/issues/671

The original debounce approach does inhibit uncontrollable scrolling through months, but it also makes the calendar feel extremely sluggish when using a Mac touchpad, as it must wait until the scrolling has completely finished/resolved before the month will change. Rather than using a debounce, throttling the scroll behavior provides a much more responsive experience.

A flat rate throttle of 1 effective scroll/month change every 100ms provides a good overall experience. But it can be still be touchy for small changes, and also feel slightly sluggish when scrolling rapidly. This implementation includes a variable rate throttle to ensure more control and precision when scrolling lightly, while allowing months to change more quickly when scrolling aggressively.

UX tested on Mac (touchpad and mouse) PC (touchpad and mouse). Regression tested on physical iOS and Android devices.