Skip to content

Commit

Permalink
fix(Dropdown): fix visibility in Drawer context
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkl2533 committed Jul 18, 2024
1 parent 06c839d commit 6c1a3e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/components/Dropdown/ControlledDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment, forwardRef, useState } from 'react';
import React, { forwardRef, useState } from 'react';
import PropTypes from 'prop-types';

import { SpaceSizes } from '../../theme';
Expand All @@ -10,7 +10,6 @@ import DropdownPane from './DropdownPane';
import { DropdownPlacements } from './Dropdown.enums';
import { mergeRefs } from '../../utils/mergeRefs';
import { useFocusTrap } from '../../hooks/useFocusTrap';
import { useFloatingContext } from '../../contexts/FloatingContext';

const ControlledDropdown = forwardRef<
HTMLDivElement,
Expand Down Expand Up @@ -45,12 +44,9 @@ const ControlledDropdown = forwardRef<

useFocusTrap({ el: paneEl, enabled: isOpen && focusTrap });
const { Portal } = usePortal();
const isInFloatingElement = useFloatingContext() ?? false;

const MaybePortal = isInFloatingElement ? Fragment : Portal;

return isOpen ? (
<MaybePortal>
<Portal>
<DropdownPane
ref={mergeRefs(ref, setPaneEl)}
arrowRef={setArrowEl}
Expand All @@ -67,7 +63,7 @@ const ControlledDropdown = forwardRef<
>
{children}
</DropdownPane>
</MaybePortal>
</Portal>
) : null;
},
);
Expand Down
1 change: 1 addition & 0 deletions src/components/_internal/BaseSingleDatePicker/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const datePickerStyles = css`
}
.react-datepicker-popper {
z-index: 10;
width: 16.25rem;
}
.react-datepicker-popper[data-placement^='bottom']
.react-datepicker__triangle,
Expand Down

0 comments on commit 6c1a3e1

Please sign in to comment.