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

[@mantine/dates] DateInput: Separate clearable and allowDeselect logic #4527

Merged

Conversation

DanielGibbsNZ
Copy link
Contributor

Fixes #4524.

The change is a bit larger than I intended but I believe it makes the clearable and allowDeselect props more understandable:

  • clearable controls whether the DateInput can be cleared (via the text field or the date picker)
  • allowDeselect controls whether clicking on the existing date in the date picker clears the field (only applicable if clearable is set), defaults to true if clearable is set

If this is too much of a change, left me know and I'll revert it back to my original idea of just allowing allowDeselect to be manually set. The downside with this approach is that it can result in some weirdly inconsistent behaviour where the value can be cleared by clicking the date when allowDeselect is set and clearable isn't set.

@rtivital rtivital merged commit 7f1b624 into mantinedev:master Jul 15, 2023
1 check passed
@rtivital
Copy link
Member

Thanks!

@DanielGibbsNZ DanielGibbsNZ deleted the fix-date-input-allow-deselect branch July 18, 2023 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allowDeselect is ignored when clearable is enabled
2 participants