Skip to content

Commit

Permalink
feat: Improve visual affordance of horizontally scrolling tables
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolaSaunders committed Jan 30, 2024
1 parent 7b0ef21 commit 54ff92f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
14 changes: 14 additions & 0 deletions assets-src/styles/sass/30-base/_animation.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*------------------------------------*\
#Animation
'scroll-shadow-inset' improves visual affordance of horizontally scrolling tables
\*------------------------------------*/

/*
Expand All @@ -18,4 +20,16 @@
transition-duration: 0.001ms !important;
transition-delay: 0s !important;
}
}

@keyframes scroll-shadow-inset {
/* start with inset shadow on right */
from {
box-shadow: inset -10px -10px 15px 0px rgb(0 0 0 / 0.3);
}

/* end with inset shadow on left */
to {
box-shadow: inset 10px -10px 15px 0px rgb(0 0 0 / 0.3);
}
}
4 changes: 4 additions & 0 deletions assets-src/styles/sass/30-base/_tables.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*------------------------------------*\
#Tables
1. See https://daverupert.com/2023/08/animation-timeline-scroll-shadows/
\*------------------------------------*/

table {
Expand Down Expand Up @@ -55,6 +57,8 @@ https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html
max-inline-size: 100% !important;

&[role][aria-labelledby][tabindex] {
animation: scroll-shadow-inset linear; /* 1 */
animation-timeline: scroll( self inline ); /* 1 */
overflow: auto;
}

Expand Down
27 changes: 27 additions & 0 deletions web/dist/styles/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,8 @@ blockquote cite {

/*------------------------------------*\
#Tables
1. See https://daverupert.com/2023/08/animation-timeline-scroll-shadows/
\*------------------------------------*/
table {
border: 1px solid #c6c6c6;
Expand Down Expand Up @@ -992,6 +994,9 @@ https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html
max-inline-size: 100% !important;
}
[data-component=table-wrap][role][aria-labelledby][tabindex] {
-webkit-animation: scroll-shadow-inset linear;
animation: scroll-shadow-inset linear; /* 1 */
animation-timeline: scroll(self inline); /* 1 */
overflow: auto;
}
[data-component=table-wrap] table {
Expand All @@ -1004,6 +1009,8 @@ https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html
}
/*------------------------------------*\
#Animation
'scroll-shadow-inset' improves visual affordance of horizontally scrolling tables
\*------------------------------------*/
/*
* Respect the choices of users who do not want animations.
Expand All @@ -1024,6 +1031,26 @@ https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html
transition-delay: 0s !important;
}
}
@-webkit-keyframes scroll-shadow-inset {
/* start with inset shadow on right */
from {
box-shadow: inset -10px -10px 15px 0px rgba(0, 0, 0, 0.3);
}
/* end with inset shadow on left */
to {
box-shadow: inset 10px -10px 15px 0px rgba(0, 0, 0, 0.3);
}
}
@keyframes scroll-shadow-inset {
/* start with inset shadow on right */
from {
box-shadow: inset -10px -10px 15px 0px rgba(0, 0, 0, 0.3);
}
/* end with inset shadow on left */
to {
box-shadow: inset 10px -10px 15px 0px rgba(0, 0, 0, 0.3);
}
}
/*------------------------------------*\
#Global focus styles incorporating a reset for :focus-visible
Expand Down
2 changes: 1 addition & 1 deletion web/dist/styles/core.min.css

Large diffs are not rendered by default.

0 comments on commit 54ff92f

Please sign in to comment.