Skip to content

Commit

Permalink
fix(datepicker): focus trap in FireFox (#17969)
Browse files Browse the repository at this point in the history
  • Loading branch information
2nikhiltom authored Nov 6, 2024
1 parent ba6bf6d commit d459e8c
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions packages/react/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,6 @@ const DatePicker = React.forwardRef(function DatePicker(
const closeCalendar = (event) => {
calendarRef.current.close();
// Remove focus from endDate calendar input
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
onCalendarClose(
calendarRef.current.selectedDates,
'',
Expand Down Expand Up @@ -918,12 +915,7 @@ const DatePicker = React.forwardRef(function DatePicker(
document.activeElement === endInputField.current &&
calendarRef.current.isOpen
) {
event.preventDefault();
calendarRef.current.close();
// Remove focus from endDate calendar input
document.activeElement instanceof HTMLElement && // this is to fix the TS warning
document?.activeElement?.blur();

onCalendarClose(
calendarRef.current.selectedDates,
'',
Expand Down

0 comments on commit d459e8c

Please sign in to comment.