scottish-government-design-system / design-system

Design System for the Scottish Government and other Scottish public sector bodies
https://designsystem.gov.scot
MIT License
25 stars 11 forks source link

Date Picker monthly navigation skips a month [BUG] #46

Closed dogle-scottlogic closed 7 months ago

dogle-scottlogic commented 8 months ago

Description of the issue

We have a requirement to set the minDate for the date picker to the last day of the previous month so that we can always navigate back one month. When we do this the navigation for months skips out the current month (See steps below).

Steps to reproduce the issue

For all steps the following variables remain constant:

Steps:

Expected behaviour

Rather than Nov -> Dec <- Oct -> Dec the navigation should be Nov -> Dec <- Nov -> Dec <- Nov <- Oct -> Nov

From a little digging it seems that what's happening is:

Likewise when we step forward again after this point:

Update: This bug is also partially reproducible in the example Date Picker on the design system website by navigating to 31/01/2024 and then clicking forward a month. Expected behaviour is to be taken to Feb, actual behaviour is you are skipped to March

Screenshots

Preview payment file _ Payments Service

Environment

jsutcliffe commented 7 months ago

Hello,

This is currently being worked on. It has exposed some flakiness in how we handle disabled dates, and we'll be refactoring how they work. We expect this to be released by 22 November 2023.

Disabled dates will be focusable but not selectable

This is an accessibility improvement. Disabled dates will not be selectable, but being able to move through disabled dates will be less jarring for a non-sighted user who might in the current date picker be jumped over a set of disabled dates with no explanation of why. Disabled dates will use aria-disabled="true" to flag this status for assistive tech.

disabled-focus-2

Date picker can be navigated through beyond allowed date ranges

This will address your use case where you want to be able to show a user an entire unavailable month ("...so that we can always navigate back one month")

Date picker next/previous month logic improved

A selection of 31 Jan will no longer skip over the entirety of February

jsutcliffe commented 7 months ago

This alteration to how the date picker works has been released in v1.2.0

jsutcliffe commented 7 months ago

Issue resolved.