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

[Input Date Picker]/[Input Time Picker] - Values should revert when an invalid date/time is entered. #10692

Closed
2 of 5 tasks
richiecarmichael opened this issue Nov 5, 2024 · 1 comment
Labels
0 - new New issues that need assignment. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. calcite-components Issues specific to the @esri/calcite-components package. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive needs triage Planning workflow - pending design/dev review.

Comments

@richiecarmichael
Copy link

richiecarmichael commented Nov 5, 2024

Check existing issues

Similar Issues

#8595 - calciteInputDatePickerChange only fires on "valid date change" - there is no way to detect field entr
#10169 - Programmatically clearing Input Date Picker value when user input invalid does not work

Actual Behavior

When a user enters an invalid date or time into the input-date-picker/input-time-picker and presses ENTER the value is not cleared. When the component loses focus, the calciteInputDatePickerChange event if fired with an empty string.

Expected Behavior

Invalid dates or time should be cleared (or revert to previous value) when ENTER is pressed.
When the component loses focus with nonsense text, the component should NOT throw a calciteInputDatePickerChange event with an empty string.

Reproduction Sample

https://codepen.io/richiecarmichael/pen/rNXZpyy?editors=1000

Reproduction Steps

  1. Open this app.
  2. Open console window of developer tools
  3. Click on the time component input
  4. Use the popup to pick a valid time (e.g. 1:00 AM)
  5. Observe that valid time string (e.g. "01:00") is written to the console.
  6. Click on the date component input again,
  7. Enter "banana"
  8. Click outside the input to blur the input-time-picker component
  9. Observe that "banana" is not cleared from the UI.
  10. Observe that an empty string is written to the console.

Reproduction Version

2.13.2

Relevant Info

No response

Regression?

No

Priority impact

impact - p3 - not time sensitive

Impact

Impacts Directions widget/component in JSSDK 4.32.

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Maps SDK for JavaScript

// @bsvensson @NoashX

@richiecarmichael richiecarmichael added 0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. needs triage Planning workflow - pending design/dev review. labels Nov 5, 2024
@github-actions github-actions bot added ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. calcite-components Issues specific to the @esri/calcite-components package. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive labels Nov 5, 2024
@DitwanP
Copy link
Contributor

DitwanP commented Nov 5, 2024

Closing because we're not pursuing this behavior for components, we want to avoid changing user-entered values as much as possible. The valueAsDate prop from issue #8578 will resolve the empty value portion of this issue and clearing the value when invalid will be up to the developers.

A quick example of how one might go about clearing resetting the input upon determining that the value is bad. If the input is in a form you could also set it's validity property as "invalid" and a custom validationMessage to let the user know.
https://codepen.io/Ditwan-Price/pen/JjgaLLR?editors=1011

@DitwanP DitwanP closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. ArcGIS Maps SDK for JavaScript Issues logged by ArcGIS SDK for JavaScript team members. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. calcite-components Issues specific to the @esri/calcite-components package. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive needs triage Planning workflow - pending design/dev review.
Projects
None yet
Development

No branches or pull requests

2 participants