From 6eaed5df904a701f95f06ecbc34b44f279d81e0e Mon Sep 17 00:00:00 2001 From: melloware Date: Sat, 20 Apr 2024 07:23:56 -0400 Subject: [PATCH] Fix #6427: Chips respect removable function --- components/lib/chips/Chips.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/lib/chips/Chips.js b/components/lib/chips/Chips.js index 9b2f8eef26..7cf99614d0 100644 --- a/components/lib/chips/Chips.js +++ b/components/lib/chips/Chips.js @@ -35,7 +35,7 @@ export const Chips = React.memo( } let values = [...props.value]; - const removedItem = values.splice(index, 1); + const removedItem = values.splice(index, 1)[0]; if (!isRemovable(removedItem, index)) { return; @@ -319,18 +319,18 @@ export const Chips = React.memo( }; const createRemoveIcon = (value, index) => { - const iconProps = mergeProps( - { - className: cx('removeTokenIcon'), - onClick: (event) => removeItem(event, index), - 'aria-hidden': 'true' - }, - ptm('removeTokenIcon') - ); - const icon = props.removeIcon || ; - const removeIcon = IconUtils.getJSXIcon(icon, { ...iconProps }, { props }); - if (!props.disabled && !props.readOnly && isRemovable(value, index)) { + const iconProps = mergeProps( + { + className: cx('removeTokenIcon'), + onClick: (event) => removeItem(event, index), + 'aria-hidden': 'true' + }, + ptm('removeTokenIcon') + ); + const icon = props.removeIcon || ; + const removeIcon = IconUtils.getJSXIcon(icon, { ...iconProps }, { props }); + return removeIcon; }