From 75d55a4a6659f554e3aa7318555a855737bcdfb0 Mon Sep 17 00:00:00 2001 From: Maikel Perez Date: Wed, 31 Jul 2024 09:03:39 -0400 Subject: [PATCH] Product Block Editor: clicking outside of the attribute modal triggers an error (#50139) * Fix clicking outside of the attribute modal triggers an error * Add changelog file --- packages/js/product-editor/changelog/fix-46638 | 4 ++++ .../src/components/attribute-control/new-attribute-modal.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 packages/js/product-editor/changelog/fix-46638 diff --git a/packages/js/product-editor/changelog/fix-46638 b/packages/js/product-editor/changelog/fix-46638 new file mode 100644 index 00000000000..1ac315d1bd8 --- /dev/null +++ b/packages/js/product-editor/changelog/fix-46638 @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix clicking outside of the attribute modal triggers an error diff --git a/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx b/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx index f5302d8e4ce..9916f0c8141 100644 --- a/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx +++ b/packages/js/product-editor/src/components/attribute-control/new-attribute-modal.tsx @@ -363,7 +363,7 @@ export const NewAttributeModal: React.FC< NewAttributeModalProps > = ( { | React.MouseEvent< Element > | React.FocusEvent< Element > ) => { - if ( ! event.isPropagationStopped() ) { + if ( ! event?.isPropagationStopped() ) { onCancel(); } } }