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

[pickers] The field should be clearable by default #4730

Closed
2 tasks done
Lure5134 opened this issue Apr 1, 2021 · 7 comments
Closed
2 tasks done

[pickers] The field should be clearable by default #4730

Lure5134 opened this issue Apr 1, 2021 · 7 comments
Labels
component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@Lure5134
Copy link

Lure5134 commented Apr 1, 2021

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

If we are using a Datepicker from the Material UI Lab in Material UI 5. The date can be cleared on the desktop version and it works gerat.
On the mobile version it indicates, that the field is filled wrong when it is empty.
image

Expected Behavior 🤔

The datepicker should be able to set the date in the mobile version to null too.

Steps to Reproduce 🕹

Steps:

  1. Import the Datepicker from @material-ui/lab/DatePicker
  2. Set a value.
  3. Try to remove it again

Your Environment 🌎

`npx @material-ui/envinfo`
  System:
    OS: Windows 10 10.0.19042
  Binaries:
    Node: 15.5.0 - C:\Program Files\nodejs\node.EXE       
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD        
    npm: 7.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 89.0.4389.90
    Edge: Spartan (44.19041.423.0), Chromium (89.0.774.63)
  npmPackages:
    @emotion/react: ^11.1.5 => 11.1.5
    @emotion/styled: ^11.1.5 => 11.1.5
    @material-ui/core: ^5.0.0-alpha.28 => 5.0.0-alpha.28  
    @material-ui/icons: ^4.9.1 => 4.11.2
    @material-ui/lab: ^5.0.0-alpha.28 => 5.0.0-alpha.28   
    @material-ui/pickers: ^3.2.10 => 3.2.10
    @material-ui/styled-engine:  5.0.0-alpha.25
    @material-ui/styles:  5.0.0-alpha.28
    @material-ui/system:  5.0.0-alpha.28
    @material-ui/types:  5.1.7
    @material-ui/unstyled:  5.0.0-alpha.28
    @material-ui/utils:  5.0.0-alpha.28
    @types/react: ^16.9.41 => 16.14.4
    react: 17.0.0 => 17.0.0
    react-dom: ^16.14.0 => 16.14.0
    typescript: ^3.9.6 => 3.9.9
@Lure5134 Lure5134 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 1, 2021
@Lure5134
Copy link
Author

Lure5134 commented Apr 1, 2021

I have now found, that there is already a property for it "clearable".

@Lure5134 Lure5134 closed this as completed Apr 1, 2021
@oliviertassinari oliviertassinari added component: data grid This is the name of the generic UI component, not the React module! component: DatePicker The React component. and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer component: data grid This is the name of the generic UI component, not the React module! labels Apr 2, 2021
@oliviertassinari oliviertassinari changed the title Material UI 5 Datepicker [DatePicker] The field should be clearable by default May 8, 2021
@oliviertassinari
Copy link
Member

I'm reopening it as it looks like a bug and a wrong behavior. A native date input is clearable by default so is the Autocomplete. We have added the disableClearable prop for it.

@Gautam-Arora24
Copy link

Working on it 🙂

@Gautam-Arora24
Copy link

Well, is there any way to remove the DatePicker's data on the mobile?

@richcatt
Copy link

richcatt commented Jan 7, 2022

Was about to open a new issue but might be covered with the work here - there doesn't appear to be a clear icon on this component (as there is for autocomplete). I guess it is similar to a standard TextField in this respect, but would be good for consistency if all fields could have this option.

Have tested on desktop with DatePicker and DesktopDatePicker.

@flaviendelangle flaviendelangle transferred this issue from mui/material-ui May 2, 2022
@flaviendelangle
Copy link
Member

Relates to #4450

I agree that we could have the clearable input icon by default.

@flaviendelangle flaviendelangle added component: pickers This is the name of the generic UI component, not the React module! and removed component: DatePicker The React component. labels May 2, 2022
@flaviendelangle flaviendelangle changed the title [DatePicker] The field should be clearable by default [oickers] The field should be clearable by default May 2, 2022
@flaviendelangle flaviendelangle changed the title [oickers] The field should be clearable by default [pickers] The field should be clearable by default May 2, 2022
@flaviendelangle
Copy link
Member

Closing in favor of #4450 to keep a single source of truth.

@flaviendelangle flaviendelangle added duplicate This issue or pull request already exists and removed breaking change labels Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants