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

feat: changes for datetimepicker component #214

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shiprarawal
Copy link
Collaborator

No description provided.

<div>
<label>
<span class="datetimepicker__select-label">Enter the travel date and time</span>
<input placeholder="Select Date..." class="datetimepicker" /><!--datetimepicker input-->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  1. Let's remove the placeholder text. (Just because I don't want to showcase it, since a lot of people tend to use it instead of labels)
  2. We need an sr-only aria-describedby that gives keyboard instructions. Something like:

"Enter in YYYY-MM-DD format or use Control + Shift + Arrow Keys to change the date".

(I believe Control + Shift + Arrow works for all operating systems, correct?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Zoltan, I have added the aria-describedby and removed the placeholder text. I will discuss about the behaviour of Control + Shift + Arrow.

</thead>
<tbody>
<tr>
<td>Up Arrow</td>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work on mobile?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described in this article, When flatpickr detects a mobile browser, it turns the date input into a native date/time/datetime input. To disable this behaviour, I have set the property, disableMobile: "true".
After setting this property, the flatpicker has the consistent look and feel across all devices.
(https://flatpickr.js.org/mobile-support/). Let me know if you feel we should remove this property.

@shiprarawal shiprarawal force-pushed the datetimepicker branch 2 times, most recently from 9c4fd9f to 7403cbc Compare August 26, 2024 15:57
function initializeFlatpickr(language) {
var fp = flatpickr(".datetimepicker", {
enableTime: true,
// disableMobile: true, // By default, Flatpicker shows the native HTML5 datepicker on mobile devices. To change this behavior and maintain a consistent appearance across all devices, set this property to true.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zoltan-dulac , I have commented these two properties for now.

  1. disableMobile : true , disable native datetime inputs in all cases
  2. allowInput:true, // allows the user to enter date using keyboard

@shiprarawal shiprarawal force-pushed the datetimepicker branch 2 times, most recently from fb0ea13 to 8c58400 Compare August 27, 2024 15:53
@zoltan-dulac
Copy link
Collaborator

There is still a lot of work that needs to go into this:

  1. I cannot enter a date by just typing it in. If I try to enter 20012102 by hand (without dashes), and tab out, it doesn't enter the date correctly (it converts to "2002-10-01", which is a really odd choice).
  2. When I cycle by month or year using a keyboard focus goes onto the first date in the calendar. It should go on the first date for the current month so it's not confusing to screen reader users. For example, if I am in April 2024, and I use Control+Shift+Left Arrow to go to the previous month, focus goes to Feb 25, 2024 instead of March 1, 2024, which I think would be expected. This is because Feb 25, 2024 is the first date in the calendar, but not the first date of the month (see screenshot below to see what I mean).

image

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.

2 participants