Skip to content

Commit

Permalink
Fix #6427: Chips respect removable function
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Apr 20, 2024
1 parent 4d4a214 commit 6eaed5d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions components/lib/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 || <TimesCircleIcon {...iconProps} />;
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 || <TimesCircleIcon {...iconProps} />;
const removeIcon = IconUtils.getJSXIcon(icon, { ...iconProps }, { props });

return removeIcon;
}

Expand Down

0 comments on commit 6eaed5d

Please sign in to comment.