diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss
index b8a9088cfd72c..4d5f22e02fa7d 100644
--- a/packages/base-styles/_z-index.scss
+++ b/packages/base-styles/_z-index.scss
@@ -208,6 +208,9 @@ $z-layers: (
// Ensure checkbox + actions don't overlap table header
".dataviews-view-table thead": 1,
+ // Ensure selection checkbox stays above the preview field.
+ ".dataviews-view-grid__card .dataviews-selection-checkbox": 1,
+
// Ensure quick actions toolbar appear above pagination
".dataviews-bulk-actions-toolbar": 2,
);
diff --git a/packages/dataviews/src/layouts/grid/index.tsx b/packages/dataviews/src/layouts/grid/index.tsx
index cbfccf5521a81..c8cac31bf7db8 100644
--- a/packages/dataviews/src/layouts/grid/index.tsx
+++ b/packages/dataviews/src/layouts/grid/index.tsx
@@ -84,18 +84,18 @@ function GridItem< Item >( {
{ renderedMediaField }
+
-
{ renderedPrimaryField }
diff --git a/packages/dataviews/src/layouts/grid/style.scss b/packages/dataviews/src/layouts/grid/style.scss
index a707401972cda..ebe039ea7543b 100644
--- a/packages/dataviews/src/layouts/grid/style.scss
+++ b/packages/dataviews/src/layouts/grid/style.scss
@@ -9,6 +9,7 @@
.dataviews-view-grid__card {
height: 100%;
justify-content: flex-start;
+ position: relative;
.dataviews-view-grid__title-actions {
padding: $grid-unit-10 0 $grid-unit-05;
@@ -22,6 +23,11 @@
.dataviews-view-grid__fields .dataviews-view-grid__field .dataviews-view-grid__field-value {
color: $gray-900;
}
+
+ .dataviews-view-grid__media::after {
+ background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
+ box-shadow: inset 0 0 0 $border-width var(--wp-admin-theme-color);
+ }
}
}
@@ -32,6 +38,7 @@
background-color: $gray-100;
border-radius: $grid-unit-05;
position: relative;
+ overflow: hidden;
img {
object-fit: cover;
@@ -148,3 +155,16 @@
.dataviews-view-grid__field:empty {
display: none;
}
+
+.dataviews-view-grid__card .dataviews-selection-checkbox {
+ position: absolute;
+ top: -9999em;
+ left: $grid-unit-10;
+ z-index: z-index(".dataviews-view-grid__card .dataviews-selection-checkbox");
+}
+
+.dataviews-view-grid__card:hover .dataviews-selection-checkbox,
+.dataviews-view-grid__card:focus-within .dataviews-selection-checkbox,
+.dataviews-view-grid__card.is-selected .dataviews-selection-checkbox {
+ top: $grid-unit-10;
+}