Skip to content

Commit

Permalink
fix(RelativePickers): always open popup on click on input (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS authored Jul 10, 2024
1 parent 873703f commit 27390e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ export function useRelativeDatePickerProps(
},
errorMessage: props.errorMessage,
errorPlacement: props.errorPlacement,
controlProps: {
onClick: () => {
if (state.disabled) {
return;
}
if (!isOpen) {
state.setActive(true);
setOpen(true);
}
},
},
};

const {inputProps} = useDateFieldProps(datePickerState.dateFieldState, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ export function RelativeRangeDatePicker(props: RelativeRangeDatePickerProps) {
'aria-expanded': open,
disabled: isMobile,
className: b('input', {mobile: isMobile}),
onClick: () => {
if (props.disabled) {
return;
}
if (!open) {
setIsActive(true);
setOpen(true);
}
},
}}
onKeyDown={(e) => {
if (props.disabled) {
Expand Down

0 comments on commit 27390e5

Please sign in to comment.