From 63db22c3f81f47693145f357ea24604ae5bf3bd6 Mon Sep 17 00:00:00 2001 From: Juan Aldasoro Date: Fri, 20 Dec 2024 14:24:12 +0100 Subject: [PATCH] Toggle if it is open, to avoid multiple selectors being open. --- .../src/components/global-styles/shadows-edit-panel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/global-styles/shadows-edit-panel.js b/packages/edit-site/src/components/global-styles/shadows-edit-panel.js index 9fd7959a6c09cb..49cfa66bbddf2a 100644 --- a/packages/edit-site/src/components/global-styles/shadows-edit-panel.js +++ b/packages/edit-site/src/components/global-styles/shadows-edit-panel.js @@ -392,7 +392,13 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) { 'aria-expanded': isOpen, }; const removeButtonProps = { - onClick: onRemove, + onClick: ( e ) => { + e.stopPropagation(); + if ( isOpen ) { + onToggle(); + } + onRemove(); + }, className: clsx( 'edit-site-global-styles__shadow-editor__remove-button', { 'is-open': isOpen }