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

Bug: calcite-input-time-picker - when entering time without ':' into input box #2331

Closed
2 tasks
AdelheidF opened this issue Jun 17, 2021 · 9 comments
Closed
2 tasks
Assignees
Labels
0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. help wanted Issues that the core team needs help with in a sprint.

Comments

@AdelheidF
Copy link

AdelheidF commented Jun 17, 2021

Actual Behavior

When editing the time value directly inside the input box then it works well if I stick to the format and leave the ‘:’ alone. If I remove a ‘:’ though things don’t work anymore. It would be nice if it added the ‘:’ automatically back in. This is especially useful if I started with an empty input box.

image

Expected Behavior

it adds ':' ever second number

Reproduction Steps or Sample

<calcite-input-time-picker></calcite-input-time-picker>
  1. Type 123456 into the input box
  2. Unfocus the input
  3. Result: the value goes away instead of being formatted as a valid 12:34:56 time value.

Relevant Info

Version: @esri/calcite-components@<version>

  • CDN
  • NPM package
@AdelheidF AdelheidF added bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jun 17, 2021
@jcfranco jcfranco added help wanted Issues that the core team needs help with in a sprint. and removed needs triage Planning workflow - pending design/dev review. labels Jul 2, 2021
@eriklharper
Copy link
Contributor

Not sure if this is a bug more so than it might be a feature request because the entered value will format correctly when the input box loses focus.

Is the requirement that the colon should be added and the value format updated on every keypress in the input box?

I avoided implementing it this way because I found the UX jarring while I was typing to see characters I hadn't typed being put in there. I opted to just let the user type the value and then worry about formatting the resulting value after they blurred the input, which commits the value. When the value isn't a valid time value, it reverts back to the previous valid value (which also includes no value).

@jcfranco thoughts?

@AdelheidF
Copy link
Author

AdelheidF commented Jul 20, 2021

because the entered value will format correctly when the input box loses focus.

This is not what I'm seeing. If I type 123456 or 120000 and click outside the input box the input box clears out. (next.245)
image

If I type in : it's fine.

Maybe it's OK to require users to enter those :.

@jcfranco
Copy link
Member

The above does look like a bug.

I agree w/ @eriklharper's comment about formatting while you type jarring. If we can fix the above without requiring : as users type, it'd make it easier to use.

@eriklharper
Copy link
Contributor

I see that now. As long as the number can convert to a valid time value, I think it should add the colons in on blur. I'll update it to do just that.

@eriklharper eriklharper self-assigned this Jul 20, 2021
@eriklharper
Copy link
Contributor

@AdelheidF : I discussed this with @jcfranco and we came up with the idea to create a new calcite-input-time component that will replace the current input box inside calcite-input-time-picker which will be modeled after the native browser implementations like this one from Chrome:

image

The behavior will essentially change from being a free-form text field, to established input fields that act as a mask for entering time values.

@jcfranco
Copy link
Member

if we can fix the above without requiring : as users type, it'd make it easier to use.

For posterity, we backed off from option this because of the many ambiguous values it introduces.

@eriklharper
Copy link
Contributor

eriklharper commented Jul 26, 2021

These ones I labeled "vague" are the values that can be interpreted multiple ways and would induce a lot of confusion if we tried to support them because some people would expect for instance 1111 to be 01:01:11 and another person might expect it to be 11:01:01

image

@AdelheidF
Copy link
Author

Is there already an issue for this calcite-input-time component? I can't find it to link here.

@AdelheidF
Copy link
Author

Issue created for calcite-input-time #2709

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. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. help wanted Issues that the core team needs help with in a sprint.
Projects
None yet
Development

No branches or pull requests

3 participants