-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Clearing date is not working as expected #10842
Comments
Screen.Recording.2023-10-30.at.14.41.19.mov |
Hello @jalalbmnf The section selection is working very similarly to how the native date input behaves. We also allow for both drag selecting and select all shortcut + delete clicking to clear the value. All the options are showcased in the following video. Screen.Recording.2023-10-30.at.13.21.51.mov |
Also is there any way to use a custom input component? Without slots or slotProps properties |
You can check the DatePicker component on Mui Datepicker documentation, when I click on to Delete key it just removes Day, Month and Year still there |
And what would you expect to happen? 🤔 I'm re-uploading a different video because, in the original answer, I posted an incomplete showcase video. Screen.Recording.2023-10-30.at.15.22.22.mov
No, there is no other option. Are you having problems with the slots approach? 🤔 |
I need to remove the date without a clear button, but I understand this thank you. |
For the second question about |
I copied this example from documentation but there is a error about |
@jalalbmnf Could you provide a live reproduction of the problem you are having? I struggle to understand, why you could be having this typing issue if you are on one of the latest package versions. 🤷 |
Just it is not working with the |
There doesn't appear to be a way to clear a mobile date picker: Reproduction:
|
Such a feature was not tested and not implemented for mobile. If you would check the slots, you can see that the Technically, it happens only because the To reliably add this behavior to mobile, we need to move away from the fact that the Input is in readonly state on Mobile Pickers. |
I see, I was only looking at DatePicker > Slots, which has a corresponding DatePicker Demo, which is linked from the mobile and desktop specific API docs, that does not indicate that some behavior is specific to desktop. Thanks for the clarification.
Thanks again! In the meantime, if anyone comes across this issue and wants something that works reasonably well, the |
Thank you for providing a temporary solution @kgregory.
|
Thank you! This was biased toward my use case so I didn’t think to support those props. I will update it. I really appreciate you taking a look at this. |
@kgregory I've come arcross this issue looking for something that works reasonably but the codesandbox link isn't working. Do you have a fresh link?
@LukasTy that's so interesting it wasn't tested for mobile as it was developed! The DatePicker component accepts the field clearable slotProps, is the component used to demo the clearable behavior, and because it renders DesktopDatePicker or MobileDatePicker depending on the device it runs on I'd suggest the current behavior is a tripping hazard. I wasn't able to find an open issue for this, would it help if I opened one? |
@lnhrdt Thank you for a good observation. 🙏 |
Hey @LukasTy! Having forgotten the context in this issue, today I got tripped up again by the date picker clearable behavior's lack of support for mobile paired with the docs's implication that it is supported on mobile. I don't have the bandwidth to help finish the implementation for mobile (still subscribed to #7869) but I thought I'd at least help tighten up your docs so other users (perhaps even my future self) can more easily understand the limitations of the clearable behavior. Check out #13786. |
@lnhrdt Thank you for your contribution, that is a great idea. 👍 |
Steps to reproduce
https://mui.com/x/react-date-pickers/date-picker/
Current behavior
No response
Expected behavior
No response
Context
No response
Your environment
npx @mui/envinfo
Search keywords: Mui Datepicker
The text was updated successfully, but these errors were encountered: