-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix KDateRange confusing selection states and end date reset after selecting start date via keyboard #888
Fix KDateRange confusing selection states and end date reset after selecting start date via keyboard #888
Conversation
…hanges and add watchers for start and end dates, to handle changes from textbox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested locally and the code changes look good to me. Things work as expected and described.
However, I think that the UX is a bit wonky in this particular case:
You cannot edit your end-date selection: Select 10/1/24 for start date, then click 10/31/24 for the end date. Oops, you meant to cilck 11/1/24! When you click 11/1/24, you have now selected 11/1/24 as the start date and basically lose your selection.
Or, similarly, say you select 10/1/24 - 11/1/24 but you really meant to only select all of October! If you click within the selection to change the end date to 10/31/24 it's instead set to your start date.
I'm not sure if that's the expected behavior but it feels odd that every time I select a date after having two dates selected that I'm starting my selection over again rather than being able to tweak it a bit.
To be clear, though, the keyboard usage works on both of the text box inputs perfectly in my testing, so this seems to address the issue it's targeting altogether.
I believe it is the expected behavior because if two dates are already set and then a new date (within the selection) is chosen, how do we decide if that new date is meant to be the start or end date? However, being able to directly edit the start and end date via the text box without resetting the date range selection is somewhat of a middle-ground solution. |
@LianaHarris360 sorry for the delay in reply here! I'm interested in @radinamatic and/or @pcenov 's thoughts here. Particularly I'm stuck on not being able to extend/edit my selection I guess - it feels like I should be able to click 1 day past my end date and extend it but, in any case, things look and feel solid to me. |
Apologies for late reply @LianaHarris360 ! We have reviewed the PR and the proposed solution does fix the original issue without any regressions regarding the keyboard navigation 👏🏽. Couple of comments for future iterations and improvements:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @LianaHarris360 ! 💯
Description
This pull request addresses the KDateRange bug in which, after initially setting a Start Date in the textbox using the keyboard, selecting another date on the calendar results in the Start Date being reset.
This pull request also clears the End Date after selecting a Start Date, but only if the Start Date is after the End Date.
This feature is not replicated when using mouse clicks to select dates on the calendar view, as it would make it difficult to remove or restart the date range values.
Issue addressed
Addresses #817
Before/after screenshots
After:
Setting a start date in the text box, then clicking to select the end date on the calendar:
TextboxThenCalendar.mov
Selecting a start date that is before and after the end date:
StartDateRenew.mov
Changelog
Steps to test
(optional) Implementation notes
At a high level, how did you implement this?
The logic within
setStartDate()
was updated so that if the start date is after the end date, the end date isnull
, otherwise, it is unchanged.Within
KDateCalendar.vue
, a watcher has been added for the propsselectedStartDate
andselectedEndDate
, which will update the localdateRange
object values, so that the calendar dates are consistent with the updates made to the dates in the KDateRange textboxes.isFirstChoice
has been converted into a computed property and its value is updated based on changes to the dateRange object values.Testing checklist
Reviewer guidance