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 2 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

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