-
Notifications
You must be signed in to change notification settings - Fork 160
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 editable table cell paddings for certain corner cases #3145
Conversation
@@ -147,28 +148,21 @@ $cell-negative-space-vertical: 2px; | |||
} | |||
&:first-child { | |||
border-inline-start: $border-placeholder; | |||
@include cell-padding-inline-start($cell-edge-horizontal-padding); |
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.
Moved from first-child:not(.is-visual-refresh)
. There is no reason to include the ":not(.is-visual-refresh)" because first column padding for VR is overridden anyways.
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 the :not()
pseudo-selectors are good for clarity and for reducing overrides, and moreover these ones in particular help separate the "non-VR" styles now that VR is the default.
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.
To me this looks like an if-else statements where if and else parts are also set apart. I think it is cleaner when some style is set as default and then another one overrides it conditionally.
I do, however, agree that VR can be the new default now. I can take a follow-up task to rework these styles so that instead of passing is-visual-refresh we will instead pass is-classic and the overrides are inverted.
&.is-visual-refresh:first-child { | ||
&:not(.has-striped-rows) { |
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.
Removed "&:not(.has-striped-rows)" because there is an explicit override for ".has-striped-rows" down below.
src/table/body-cell/styles.scss
Outdated
&.sticky-cell-pad-inline-start:not(.has-selection) { | ||
@include cell-padding-inline-start($cell-horizontal-padding); | ||
@include cell-padding-inline-start(awsui.$space-xxxs); | ||
&.body-cell-editable:hover { |
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.
Removed the ":not(.body-cell-edit-active)" prefix because the active edit cell cannot be hovered anyways. This also fixes the bug when the wrong padding was assigned for sticky + editable + hovered cells.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3145 +/- ##
========================================
Coverage 96.40% 96.40%
========================================
Files 785 784 -1
Lines 22109 22131 +22
Branches 7586 7186 -400
========================================
+ Hits 21314 21336 +22
- Misses 743 788 +45
+ Partials 52 7 -45 ☔ View full report in Codecov by Sentry. |
@@ -246,9 +242,6 @@ $cell-negative-space-vertical: 2px; | |||
transition-duration: awsui.$motion-duration-transition-show-quick; | |||
transition-timing-function: awsui.$motion-easing-sticky; | |||
} | |||
&-pad-left:not(.has-selection):not(.is-visual-refresh.body-cell:first-child.has-striped-rows) { | |||
@include cell-padding-inline-start(awsui.$space-table-horizontal); |
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.
Removed this completely. The table cells should use normal paddings also when sticky.
@@ -418,7 +411,8 @@ $cell-negative-space-vertical: 2px; | |||
} | |||
@include cell-padding-inline-start($editing-cell-padding-inline); | |||
@include cell-padding-inline-end($editing-cell-padding-inline); | |||
@include cell-padding-block($editing-cell-padding-block); | |||
@include cell-padding-block-start($editing-cell-padding-block); | |||
@include cell-padding-block-end(calc($editing-cell-padding-block + 1px)); |
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.
Adding a small extra space here ensures better input alignment especially in compact mode.
Good finding! Somehow that wasn't observed in the table itself. I updated styles so that cell hover override is applied for multiple conditions taking the corresponding padding. That also fixed slight cell shaking in the first column in certain conditions. Before (main): Screen.Recording.2024-12-20.at.06.56.13.movAfter: Screen.Recording.2024-12-20.at.06.57.16.mov |
Description
The PR includes two small fixes and minor refactoring for editable table cell styles:
Before:
Screen.Recording.2024-12-17.at.10.50.24.mov
After:
Screen.Recording.2024-12-17.at.10.49.35.mov
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.