From 53a4d512fc9e296c78bb86101932bd1a4a0c074e Mon Sep 17 00:00:00 2001 From: Andy Peatling Date: Thu, 2 Feb 2023 08:34:19 -0800 Subject: [PATCH] Pattern Explorer Modal: Select the first category as the initial category (#47661) * Pass the first pattern category as the initially selected category in the pattern explorer modal. * If there is a selected category, make sure we use that instead. * Update packages/block-editor/src/components/inserter/block-patterns-tab.js Co-authored-by: George Mamadashvili --------- Co-authored-by: George Mamadashvili --- .../block-editor/src/components/inserter/block-patterns-tab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/inserter/block-patterns-tab.js b/packages/block-editor/src/components/inserter/block-patterns-tab.js index 3e0b9407543ab..ea1332dc63d0d 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-tab.js +++ b/packages/block-editor/src/components/inserter/block-patterns-tab.js @@ -195,6 +195,7 @@ function BlockPatternsTabs( { } ) { const [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false ); const categories = usePatternsCategories( rootClientId ); + const initialCategory = selectedCategory || categories[ 0 ]; const isMobile = useViewportMatch( 'medium', '<' ); return ( <> @@ -261,7 +262,7 @@ function BlockPatternsTabs( { ) } { showPatternsExplorer && ( setShowPatternsExplorer( false ) } />