ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: datetime, pressing up and down in text entry mode jumps to wrong item in wheel picker

Open Ericlm opened this issue 4 months ago • 4 comments

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

There seems to have issues with the ion-datetime component, when the time modal is focused and that we try to interact with it via arrow keys.

  1. The hours does not seem to handle the current hour (that is, if it's 10 and then you press Up, it goes to 1)
  2. When you continue pressing, it goes up to 19 and then goes back to 2.
  3. Once it's back to 2, the minutes get incremented, but only 10 by 10

Note : In my timezone, the time is 0-23 based

Expected Behavior

  1. Pressing an arrow should make it move 1 hour+-, starting from the current input hour
  2. I guess the input should goes up to 23, then goes to the minutes (but it needs a focus state ?)
  3. When the minutes wheel is focused, it should respect the step entered (and not be only 10 by 10 at the beginning)

Steps to Reproduce

I tried everything on the "basic usage" example of the ion-datetime component : https://ionicframework.com/docs/api/datetime#basic-usage

Code Reproduction URL

https://ionicframework.com/docs/api/datetime#basic-usage

Ionic Info

Not applicable (https://ionicframework.com/docs/api/datetime#basic-usage)

Additional Information

No response

Ericlm avatar Jan 19 '24 09:01 Ericlm

Which browser are you testing this on?

liamdebeasi avatar Jan 19 '24 14:01 liamdebeasi

I tested it on Firefox, Chrome and Safari (all on macOS)

Ericlm avatar Jan 19 '24 14:01 Ericlm

Thanks for the additional information. I think the problem here is you've activated the "text entry mode" in the time picker. This allows users to type a time in instead of dragging/clicking. However, we set type="number" on the input, so using the arrow keys is incrementing or decrementing that time inside of the input which can cause strange behaviors. I'm not clear on whether arrow keys should work at the same time as keyboard entry, but I'll check with the team for clarification on that.

liamdebeasi avatar Jan 19 '24 15:01 liamdebeasi

Alright, thank you for your help! :)

Ericlm avatar Jan 22 '24 08:01 Ericlm