From 52eb035abd5880840a9f83467f655a07b3e97605 Mon Sep 17 00:00:00 2001 From: andresin87 Date: Wed, 13 Mar 2024 11:15:12 +0100 Subject: [PATCH] fix(combobox): disclosure --- packages/components/combobox/src/ComboboxDisclosure.tsx | 2 ++ packages/components/combobox/src/ComboboxTrigger.tsx | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/components/combobox/src/ComboboxDisclosure.tsx b/packages/components/combobox/src/ComboboxDisclosure.tsx index afdeee76b..0e813b2a7 100644 --- a/packages/components/combobox/src/ComboboxDisclosure.tsx +++ b/packages/components/combobox/src/ComboboxDisclosure.tsx @@ -29,6 +29,7 @@ export const Disclosure = forwardRef( const ctx = useComboboxContext() const { ref: downshiftRef, ...downshiftDisclosureProps } = ctx.getToggleButtonProps({ + disabled: ctx.disabled || ctx.readOnly, onClick: event => { event.stopPropagation() }, @@ -46,6 +47,7 @@ export const Disclosure = forwardRef( {...downshiftDisclosureProps} {...props} aria-label={isOpen ? openedLabel : closedLabel} + disabled={ctx.disabled} > diff --git a/packages/components/combobox/src/ComboboxTrigger.tsx b/packages/components/combobox/src/ComboboxTrigger.tsx index 7adc41f18..ed3ba30bd 100644 --- a/packages/components/combobox/src/ComboboxTrigger.tsx +++ b/packages/components/combobox/src/ComboboxTrigger.tsx @@ -34,7 +34,6 @@ export const Trigger = forwardRef( const readOnly = field.readOnly || ctx.readOnly const hasClearButton = !!clearButton && !disabled && !readOnly - const hasDisclosure = !!disclosure && !disabled && !readOnly return ( <> @@ -62,7 +61,7 @@ export const Trigger = forwardRef( {input} {hasClearButton && clearButton} - {hasDisclosure && disclosure} + {disclosure}