Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(datetime): scroll to newly selected date when value changes #27806
fix(datetime): scroll to newly selected date when value changes #27806
Changes from all commits
ce4c2eb
39d6871
5c13d59
e6a9ed5
5ae63ec
27d76c7
237f015
e79a558
59e0bde
db126be
2877537
21e3648
f90bcc4
79b8e92
69267e4
ab9bf27
cbfc8e9
4cf6270
fd9508e
10b70ed
dda4f0b
7a3f927
3dd1732
607f43c
c57c6fe
f3679c1
3fe32dc
53e288e
692a270
17224a1
a077005
bf67e71
07426c6
d2cd559
aa9d1da
24061b6
cf4128f
5c842cf
90a92d1
bf0fc24
50703df
8936c02
cb3f835
b1ccb75
fbf2f9c
b85c7df
3d79ec9
419b12a
129b370
d884163
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Unsure if this is a bug, but if I open the month/year picker as the view datetime begins to animate, the animation gets cancelled and the view never updates to the new value.
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'm actually seeing it update; maybe I'm just not doing it quickly enough? (Screencast below.) Even if there is a specific timing that borks it, though, I'm not too worried as long as the highlighted date is correct once you do scroll to it. Seems like a small edge case that could be addressed separately.
2023-08-16.14-18-57.mp4
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 think I had outdated code as I can no longer repro the issue I mentioned. However, another bug exists:
Switching to the month/year picker as the animation starts seems to break date selection altogether.
datetime-break.mov
Tested on Chrome 116. I added the following code to
datetime/test/display/index.html
to get the datetime to update async: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'm able to trigger that on
main
as well, using the next/prev month buttons. The animation goes through the same methods, so it's the same bug. Thoughts on addressing it separately?2023-08-18.14-17-38.mp4
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.
Yeah that works for me 👍
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.
Ticket created: https://ionic-cloud.atlassian.net/browse/FW-4997
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.
This change avoids a crash when manually setting a multiple selection datetime's value to
[]
, by treating an empty array the same as setting the value toundefined
(i.e. clearing the selected dates). This is done by themultiple
test when the fixture'sgoto
is called without passing in a default value.I believe we weren't seeing the test crash before because
processValue
wasn't used when updating the value async, although I wouldn't be surprised if it was still possible to trigger this buggy behavior, just with different circumstances.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.
If you set datetime to a time it still scrolls to another month and then abruptly resets to the selected month.
Example:
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 fixed the wonky scrolling in fbf2f9c. The datetime now errors out if you do this, but it looks like this case (setting the value to just a time when the
presentation
is something other than justtime
) was never supported; I'm able to trigger the same error onmain
after messing with it a bit. (Screencast below.) I'm thinking it would be good to add a warning for this improper usage in a separate ticket. Thoughts?2023-08-08.11-12-18.mp4
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.
Ticket created: https://ionic-cloud.atlassian.net/browse/FW-4996
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 moved these further down to avoid an error where if a
min
ormax
is provided without a year, these functions would error out. This was becauseparseMinParts
andparseMaxParts
fall back to the current year (link), which is passed in viatodayParts
grabbed from the datetime. Previously,todayParts
was being set after these functions were called, so it was stillundefined
.I'm unsure why this wasn't causing problems before, but it was causing the minmax test to crash now.