Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker variant="static" doesn't respect disabled #2172

Closed
2 tasks done
scottlamb opened this issue Feb 18, 2021 · 3 comments
Closed
2 tasks done

DatePicker variant="static" doesn't respect disabled #2172

scottlamb opened this issue Feb 18, 2021 · 3 comments
Labels
status: needs triage These issues haven't been looked at yet by a maintainer.

Comments

@scottlamb
Copy link

  • 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.

image

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:

  1. 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:

image

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.
@scottlamb scottlamb added the status: needs triage These issues haven't been looked at yet by a maintainer. label Feb 18, 2021
@scottlamb
Copy link
Author

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)

@oliviertassinari
Copy link
Member

oliviertassinari commented Feb 18, 2021

@scottlamb Did you try to reproduce the issue with the v5?

@scottlamb
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage These issues haven't been looked at yet by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants