diff --git a/packages/edit-site/src/components/page-patterns/grid-item.js b/packages/edit-site/src/components/page-patterns/grid-item.js
index d8e3b2fe16d532..b78c58f5a25724 100644
--- a/packages/edit-site/src/components/page-patterns/grid-item.js
+++ b/packages/edit-site/src/components/page-patterns/grid-item.js
@@ -13,7 +13,6 @@ import {
MenuGroup,
MenuItem,
__experimentalHStack as HStack,
- __unstableCompositeItem as CompositeItem,
Tooltip,
Flex,
} from '@wordpress/components';
@@ -31,7 +30,6 @@ import {
} from '@wordpress/icons';
import { store as noticesStore } from '@wordpress/notices';
import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
-import { DELETE, BACKSPACE } from '@wordpress/keycodes';
/**
* Internal dependencies
@@ -65,12 +63,6 @@ function GridItem( { categoryId, item, ...props } ) {
categoryType: item.type,
} );
- const onKeyDown = ( event ) => {
- if ( DELETE === event.keyCode || BACKSPACE === event.keyCode ) {
- setIsDeleteDialogOpen( true );
- }
- };
-
const isEmpty = ! item.blocks?.length;
const patternClassNames = classnames( 'edit-site-patterns__pattern', {
'is-placeholder': isEmpty,
@@ -137,129 +129,120 @@ function GridItem( { categoryId, item, ...props } ) {
);
return (
- <>
-
-
- `${ descriptionId }-${ index }`
- )
- .join( ' ' )
- : undefined
- }
+
+
+ { ariaDescriptions.map( ( ariaDescription, index ) => (
+
- { isEmpty && __( 'Empty pattern' ) }
- { ! isEmpty &&
}
-
- { ariaDescriptions.map( ( ariaDescription, index ) => (
-
- { ariaDescription }
-
- ) ) }
+ { ariaDescription }
+
+ ) ) }
+
-
- { itemIcon && (
-
- ) }
-
- { item.title }
- { item.type === PATTERNS && (
-
-
-
-
-
- ) }
-
-
-
- { ( { onClose } ) => (
-
- { isCustomPattern && ! hasThemeFile && (
-
+ { itemIcon && (
+
+ ) }
+
+ { item.title }
+ { item.type === PATTERNS && (
+
+
+
+
+
+ ) }
+
+
+
+ { ( { onClose } ) => (
+
+ { isCustomPattern && ! hasThemeFile && (
+
- { isCustomPattern && (
-
- ) }
-
- ) }
-
-
-
+ ) }
+
+ { isCustomPattern && (
+
+ ) }
+
+ ) }
+
+
+
{ isDeleteDialogOpen && (
) }
- >
+
);
}
diff --git a/packages/edit-site/src/components/page-patterns/grid.js b/packages/edit-site/src/components/page-patterns/grid.js
index b9b7053c112ce6..1902b36982c144 100644
--- a/packages/edit-site/src/components/page-patterns/grid.js
+++ b/packages/edit-site/src/components/page-patterns/grid.js
@@ -1,11 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- __unstableComposite as Composite,
- __unstableUseCompositeState as useCompositeState,
- __experimentalText as Text,
-} from '@wordpress/components';
+import { __experimentalText as Text } from '@wordpress/components';
import { useRef } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
@@ -17,7 +13,6 @@ import GridItem from './grid-item';
const PAGE_SIZE = 100;
export default function Grid( { categoryId, items, ...props } ) {
- const composite = useCompositeState( { wrap: true } );
const gridRef = useRef();
if ( ! items?.length ) {
@@ -29,8 +24,7 @@ export default function Grid( { categoryId, items, ...props } ) {
return (
<>
-
) ) }
-
+
{ restLength > 0 && (
{ sprintf(
diff --git a/packages/edit-site/src/components/page-patterns/style.scss b/packages/edit-site/src/components/page-patterns/style.scss
index 64dcb61ac1a74d..d6f0b897d0cf2a 100644
--- a/packages/edit-site/src/components/page-patterns/style.scss
+++ b/packages/edit-site/src/components/page-patterns/style.scss
@@ -61,6 +61,12 @@
}
}
+.edit-site-patterns__section-header {
+ .screen-reader-shortcut:focus {
+ top: 0;
+ }
+}
+
.edit-site-patterns__grid {
display: grid;
grid-template-columns: 1fr;
@@ -77,13 +83,17 @@
display: flex;
flex-direction: column;
.edit-site-patterns__preview {
- border-radius: $radius-block-ui;
+ box-shadow: none;
+ border: none;
+ padding: 0;
+ background-color: unset;
+ box-sizing: border-box;
+ border-radius: 4px;
cursor: pointer;
overflow: hidden;
&:focus {
- box-shadow: inset 0 0 0 2px $white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
-
+ box-shadow: inset 0 0 0 0 $white, 0 0 0 2px var(--wp-admin-theme-color);
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
}
@@ -91,6 +101,10 @@
&.is-inactive {
cursor: default;
}
+ &.is-inactive:focus {
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $gray-800;
+ opacity: 0.8;
+ }
}
.edit-site-patterns__footer,