-
Notifications
You must be signed in to change notification settings - Fork 162
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: Fixes calendar jumping when switching months #3178
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3178 +/- ##
==========================================
+ Coverage 96.40% 96.43% +0.02%
==========================================
Files 784 788 +4
Lines 22143 22256 +113
Branches 7594 7233 -361
==========================================
+ Hits 21348 21463 +115
+ Misses 788 786 -2
Partials 7 7 ☔ View full report in Codecov by Sentry. |
084a386
to
3919c00
Compare
55f388c
to
83d7c37
Compare
dca0d08
to
82b9d62
Compare
82b9d62
to
e1dc31c
Compare
535f143
to
6a4dfb1
Compare
@@ -122,7 +123,7 @@ export class DrpDropdownWrapper extends ComponentWrapper { | |||
): CalendarDateWrapper { | |||
const gridClassName = grid === 'right' ? styles['second-grid'] : styles['first-grid']; | |||
return this.findComponent( | |||
`.${gridClassName} .${gridStyles.week}:nth-child(${row}) .${gridStyles.day}:nth-child(${column})`, | |||
`.${gridClassName} .${testStyles['calendar-week']}[data-awsui-weekindex="${row}"] .${testStyles['calendar-date']}:nth-child(${column})`, |
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.
Using data- attribute instead of :nth-child() to exclude rows with placeholder dates only. That is necessary for the backward-compatibility, to ensure the indices of the monthly dates do not change.
6a4dfb1
to
0fc25bf
Compare
isSelectionRight: boolean; | ||
} | ||
|
||
export class MonthCalendar { |
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.
The calendar abstraction helps calculating indices and styles for calendar grid, which is non-trivial due to presence of placeholder dates that are treated differently.
Ideally, the same abstraction should be reused between Calendar, and Date range picker components. However, those are currently using very different implementations and only one supports the year calendar. We can reuse the code between the components as soon we update those to use the same calendar element implementation.
Description
The PR introduces placeholder dates to Calendar, Date picker, and Date range picker components such that each calendar always has exactly 6 rows of dates which ensures its size stays constant when user switches between months.
Rel: [llayAeObY9Ic], AWSUI-60266, #3140
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.