Skip to content

Commit

Permalink
[@mantine/dates] PickerInputBase: Fix for input focus on label click
Browse files Browse the repository at this point in the history
  • Loading branch information
rommelmamedov committed Aug 9, 2023
1 parent b8456b9 commit 6b57c64
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export const PickerInputBase = forwardRef<HTMLButtonElement, PickerInputBaseProp
dropdownHandlers.close();
};

const hasLabel = wrapperProps.label;

return (
<>
{dropdownType === 'modal' && !readOnly && (
Expand All @@ -155,12 +157,12 @@ export const PickerInputBase = forwardRef<HTMLButtonElement, PickerInputBaseProp
opened={dropdownOpened}
onClose={handleClose}
disabled={dropdownType === 'modal' || readOnly}
trapFocus
trapFocus={!hasLabel}
returnFocus
unstyled={unstyled}
{...popoverProps}
>
<Popover.Target>
<Popover.Target shouldOverrideDefaultTargetId={!hasLabel}>
<Input
data-dates-input
data-read-only={readOnly || undefined}
Expand Down

0 comments on commit 6b57c64

Please sign in to comment.