From b76de86ffe89b437808a7a56c48021838fcb2d8a Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Fri, 31 May 2024 13:39:34 +0300 Subject: [PATCH] CustomSelectControl: Fix menuProps mutation (#62149) Co-authored-by: tyxla Co-authored-by: mirka <0mirka00@git.wordpress.org> --- packages/components/src/custom-select-control/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/components/src/custom-select-control/index.js b/packages/components/src/custom-select-control/index.js index 979aa0f7bdff8d..58ca5a961a138c 100644 --- a/packages/components/src/custom-select-control/index.js +++ b/packages/components/src/custom-select-control/index.js @@ -114,7 +114,7 @@ export default function CustomSelectControl( props ) { return sprintf( __( 'Currently selected: %s' ), selectedItem.name ); } - const menuProps = getMenuProps( { + let menuProps = getMenuProps( { className: 'components-custom-select-control__menu', 'aria-hidden': ! isOpen, } ); @@ -131,7 +131,11 @@ export default function CustomSelectControl( props ) { if ( menuProps[ 'aria-activedescendant' ]?.startsWith( 'downshift-null' ) ) { - delete menuProps[ 'aria-activedescendant' ]; + const { + 'aria-activedescendant': ariaActivedescendant, + ...restMenuProps + } = menuProps; + menuProps = restMenuProps; } return (