From 2685baed6eb22a71549ff48c82a876dea4cf83cd Mon Sep 17 00:00:00 2001 From: snturk Date: Sun, 24 Mar 2024 12:30:34 +0300 Subject: [PATCH] [@mantine/core] Fix `Pill` to respect disabled state (#5959) --- packages/@mantine/core/src/components/Pill/Pill.tsx | 5 +++++ .../@mantine/core/src/components/TagsInput/TagsInput.tsx | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/@mantine/core/src/components/Pill/Pill.tsx b/packages/@mantine/core/src/components/Pill/Pill.tsx index 11006659c34..793d6ae588c 100644 --- a/packages/@mantine/core/src/components/Pill/Pill.tsx +++ b/packages/@mantine/core/src/components/Pill/Pill.tsx @@ -128,6 +128,7 @@ export const Pill = factory((_props, ref) => { tabIndex={-1} aria-hidden unstyled={unstyled} + disabled={disabled} {...removeButtonProps} {...getStyles('remove', { className: removeButtonProps?.className, @@ -139,6 +140,10 @@ export const Pill = factory((_props, ref) => { removeButtonProps?.onMouseDown?.(event); }} onClick={(event) => { + if (disabled) { + event.preventDefault(); + return; + } event.stopPropagation(); onRemove?.(); removeButtonProps?.onClick?.(event); diff --git a/packages/@mantine/core/src/components/TagsInput/TagsInput.tsx b/packages/@mantine/core/src/components/TagsInput/TagsInput.tsx index 7b8f56257f9..27b0eea3868 100644 --- a/packages/@mantine/core/src/components/TagsInput/TagsInput.tsx +++ b/packages/@mantine/core/src/components/TagsInput/TagsInput.tsx @@ -301,6 +301,7 @@ export const TagsInput = factory((_props, ref) => { { setValue(_value.filter((i) => item !== i)); onRemove?.(item);