From ffc90473d2c79e15b8a18b00e56ec60dd0076d6c Mon Sep 17 00:00:00 2001 From: Ella Date: Thu, 14 Nov 2024 13:56:05 +0100 Subject: [PATCH 1/2] Site Editor: Styles: fix inspector opening --- .../edit-site/src/components/global-styles-sidebar/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/global-styles-sidebar/index.js b/packages/edit-site/src/components/global-styles-sidebar/index.js index b1cf4fec92c86..423f54f233929 100644 --- a/packages/edit-site/src/components/global-styles-sidebar/index.js +++ b/packages/edit-site/src/components/global-styles-sidebar/index.js @@ -133,7 +133,7 @@ export default function GlobalStylesSidebar() { const previousActiveAreaRef = useRef( null ); useEffect( () => { - if ( path === '/wp_global_styles' && canvas === 'edit' ) { + if ( path.startsWith( '/wp_global_styles' ) && canvas === 'edit' ) { previousActiveAreaRef.current = getActiveComplementaryArea( 'core' ); enableComplementaryArea( 'core', 'edit-site/global-styles' ); From 1bf146179d3192670a9e9f076568570a84b07671 Mon Sep 17 00:00:00 2001 From: Ella Date: Thu, 14 Nov 2024 15:39:31 +0100 Subject: [PATCH 2/2] Guard for undefined --- .../edit-site/src/components/global-styles-sidebar/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/global-styles-sidebar/index.js b/packages/edit-site/src/components/global-styles-sidebar/index.js index 423f54f233929..d46346b50dae3 100644 --- a/packages/edit-site/src/components/global-styles-sidebar/index.js +++ b/packages/edit-site/src/components/global-styles-sidebar/index.js @@ -133,7 +133,7 @@ export default function GlobalStylesSidebar() { const previousActiveAreaRef = useRef( null ); useEffect( () => { - if ( path.startsWith( '/wp_global_styles' ) && canvas === 'edit' ) { + if ( path?.startsWith( '/wp_global_styles' ) && canvas === 'edit' ) { previousActiveAreaRef.current = getActiveComplementaryArea( 'core' ); enableComplementaryArea( 'core', 'edit-site/global-styles' );