DatePicker variant="static" doesn't respect disabled
scottlamb opened this issue · 3 comments
- The issue is present in the latest release. (That is: I tried the latest released version, 3.2.10. I see there are some alphas which I haven't tried.)
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
If I create a static DatePicker
such as this:
<DatePicker
variant="static"
disabled={true}
value={null}
onChange={...}
/>
the disabled
attribute appears to have no effect. All the dates appear enabled; the current date is selected.
and my onChange
handler runs when a day is clicked.
Expected Behavior 🤔
I'd prefer that all days appear disabled and no callbacks run. This seems consistent with the docs, which say disabled
will "Disable picker and text field".
Steps to Reproduce 🕹
https://codesandbox.io/s/hardcore-moser-qhexe
Steps:
- just look at the page...
Context 🔦
My software's UI is oriented to selecting/viewing existing segments of video. It only makes sense to select dates in which there is video available. Sometimes there are no such dates, eg if there are currently no cameras selected to view or if recording is broken. I think a static date picker makes the most sense because which dates are available is information I don't want to hide behind a click. I also don't think it makes sense for the date picker to appear and disappear (and thus other UI elements jump) based on whether any selection is valid; I'd rather it just appear disabled.
In my existing (ancient jQuery UI-based) interface, the date picker looks like this when disabled:
That's roughly what I want to match in my React/material-ui-based UI rewrite.
Your Environment 🌎
Tech | Version |
---|---|
@material-ui/core | v4.11.3 |
@material-ui/pickers | v3.2.10 |
React | 17.0.1 |
Browser | Chrome 88.0.4324.150 |
TypeScript | yes |
etc. |
I just noticed the README banner: "This project is not longer supported. See #2157 for more details." I will move this over to https://github.com/mui-org/material-ui with a demo using that version...
(although if anyone who happens to read this has an easy workaround on this version, I'd be grateful)
@scottlamb Did you try to reproduce the issue with the v5?