Skip to content

Commit 91f09b3

Browse files
jameskosterntsekourasyouknowriad
authored
DataViews: Sticky elements inherit bg from container (WordPress#73240)
Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
1 parent 0852dcf commit 91f09b3

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

packages/dataviews/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Enhancements
66

7+
- DataViews: Make sticky elements (table headers, footer, actions column) inherit background colors from parent container. This allows DataViews instances to seamlessly adapt to containers with custom background colors. [#73240](https://github.com/WordPress/gutenberg/pull/73240)
78
- DataViews table layout: only apply hover styles when bulk actions are available. [#73248](https://github.com/WordPress/gutenberg/pull/73248)
89
- Improve docs for Edit component. [#73202](https://github.com/WordPress/gutenberg/pull/73202)
910
- Field API: introduce the `format` prop to format the `date` field type. [#72999](https://github.com/WordPress/gutenberg/pull/72999)

packages/dataviews/src/components/dataviews-footer/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
position: sticky;
77
bottom: 0;
88
left: 0;
9-
background-color: $white;
9+
background-color: inherit;
1010
padding: $grid-unit-15 $grid-unit-60;
1111
border-top: $border-width solid $gray-100;
1212
flex-shrink: 0;

packages/dataviews/src/components/dataviews/style.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
flex-direction: column;
1515
font-size: $default-font-size;
1616
line-height: $default-line-height;
17+
background-color: inherit;
1718
}
1819

1920
.dataviews__view-actions,
@@ -23,6 +24,7 @@
2324
flex-shrink: 0;
2425
position: sticky;
2526
left: 0;
27+
background-color: inherit;
2628

2729
@media not (prefers-reduced-motion) {
2830
transition: padding ease-out 0.1s;

packages/dataviews/src/dataviews-layouts/picker-table/style.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Add any picker-specific overrides here if needed in the future.
44

55
.dataviews-view-picker-table {
6+
background-color: inherit;
7+
68
tbody:focus-visible {
79
// Only show one focus outline at a time. When focus is on a child element,
810
// hide the table's own focus outline.

packages/dataviews/src/dataviews-layouts/table/style.scss

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
position: relative;
1212
color: $gray-700;
1313
margin-bottom: auto;
14+
background-color: inherit;
1415

1516
th {
1617
text-align: left;
@@ -29,7 +30,7 @@
2930
&.dataviews-view-table__actions-column--sticky {
3031
position: sticky;
3132
right: 0;
32-
background-color: $white;
33+
background-color: inherit;
3334
}
3435

3536
&.dataviews-view-table__actions-column--stuck {
@@ -56,6 +57,7 @@
5657
}
5758
tr {
5859
border-top: 1px solid $gray-100;
60+
background-color: inherit;
5961

6062
.dataviews-view-table-header-button {
6163
gap: $grid-unit-05;
@@ -102,7 +104,7 @@
102104
}
103105

104106
&.is-selected {
105-
background-color: rgba(var(--wp-admin-theme-color--rgb), 0.04);
107+
background-color: color-mix(in srgb, rgb(var(--wp-admin-theme-color--rgb)) 4%, $white);
106108
color: $gray-700;
107109

108110
&,
@@ -111,7 +113,7 @@
111113
}
112114

113115
&:hover {
114-
background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
116+
background-color: color-mix(in srgb, rgb(var(--wp-admin-theme-color--rgb)) 8%, $white);
115117
}
116118

117119
.dataviews-view-table__actions-column--sticky {
@@ -150,6 +152,7 @@
150152
position: sticky;
151153
inset-block-start: 0;
152154
z-index: z-index(".dataviews-view-table thead");
155+
background-color: inherit;
153156

154157
tr {
155158
border: 0;
@@ -159,7 +162,7 @@
159162
}
160163
}
161164
th {
162-
background-color: $white;
165+
background-color: inherit;
163166
padding-top: $grid-unit-10;
164167
padding-bottom: $grid-unit-10;
165168
padding-left: $grid-unit-15;

0 commit comments

Comments
 (0)