question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useCalendarCell equates "outside of visible range" with "disabled".

See original GitHub issue

🐛 Bug Report

useCalendarCell returns true for isDisabled when calendar dates are outside the visible date range (i.e. isOutsideVisibleRange is true), but are still within minValue and maxValue, and are not passed an isDisabled prop. This is preventing click/press events on those dates.

🤔 Expected Behavior

You should be able to click on dates that are outside the “visible” date range of the current month, but aren’t otherwise marked as unavailable or disabled. This would mirror the behavior in the native HTML5 datepicker.

😯 Current Behavior

Dates outside of the visible date range are being marked as isDisabled internally. This prevents any of the click/press events from firing. Based on the description of isDisabled , I believe this could be a bug.

E.g., If I’m looking at June 2022, July 1st can be made visible, but cannot be made clickable (because it is being marked internally as isDisabled). However, July 1st is enabled and clickable from the July 2022 calendar.

💁 Possible Solution

Dates outside of the current month should not be marked as isDisabled. From a styling perspective, we still have isOutsideVisibleRange to work with, and the dates would still be properly disabled if they fell outside of the min/max values.

If this is expected behavior and changing this would constitute a breaking change, adding a calendar-level prop something like disableOutsideVisibleRange and defaulting it to true would provide users a viable workaround.

🔦 Context

I am trying to replicate behavior found in the standard HTML5 datepicker, wherein selecting a date from the previous/next month, if it is visible in the calendar, is possible. My goal is to not lose features when switching over.

💻 Code GIF Sample

Here’s a GIF of my implementation of useDatepicker, useCalendar, etc: aria-dateinput-cant-click

And here’s an example of the same behavior with a standard HTML5 <input type="date" />: html-dateinput-clicking

🌍 Your Environment

Software Version(s)
react-spectrum 3.0.0
Browser Chrome
Operating System macOS Big Sur

🧢 Your Company/Team

N/A

🕷 Tracking Issue (optional)

N/A

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Drogglbechercommented, Dec 8, 2022

I face the same problem while trying to implement a DateRangePicker based on the RangeCalendar. Is there currently any status update or workaround?

1reaction
devongovettcommented, Jun 22, 2022

One problem with this design is the dates still look disabled visually (grayed out). If they are interactive, they’d need to meet WCAG contrast minimums as well to be accessible. Not to say we shouldn’t support more control here though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

useCalendar – React Aria - React Spectrum Libraries
Disabled dates are not focusable, and cannot be selected by the user. They are typically displayed with a dimmed appearance. isUnavailable, boolean. Whether...
Read more >
React Datepicker - prevent range with disabled dates in ...
I am using filterDate to disable some dates. <DatePicker selected={startDate} onChange={changeRangeHandler} startDate={startDate} ...
Read more >
useCalendarCell equates "outside of visible range" with "disabled ...
This issue has been created since 2022-06-22. Bug Report. useCalendarCell returns true for isDisabled when calendar dates are outside the visible date range...
Read more >
devongovett (devongovett) - DevFaults
BUG: `grid-template` area names incorrectly modfified with CSS Modules ... useCalendarCell equates "outside of visible range" with "disabled".
Read more >
How to disable "Auto completion suggests commands"
YOU MAY BE INTERESTED ; useCalendarCell equates "outside of visible range" with "disabled". 4, 2022-06-22, 2022-09-26 ; Symfony 5 - TraceableFirewallListener Ajax ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found