Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/modals/src/elements/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export const ModalComponent = forwardRef<HTMLDivElement, IModalProps>(
onClose,
modalRef,
focusOnMount,
restoreFocus
restoreFocus,
environment
});

useEffect(() => {
Expand Down
11 changes: 9 additions & 2 deletions packages/modals/src/elements/TooltipDialog/TooltipDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ import { Body } from './Body';
import { Close } from './Close';
import { Footer } from './Footer';
import { FooterItem } from './FooterItem';
import { DEFAULT_THEME, getFloatingPlacements, useText } from '@zendeskgarden/react-theming';
import {
DEFAULT_THEME,
getFloatingPlacements,
useText,
useDocument
} from '@zendeskgarden/react-theming';
import { createPortal } from 'react-dom';

const PLACEMENT_DEFAULT = 'top';
Expand Down Expand Up @@ -64,6 +69,7 @@ const TooltipDialogComponent = React.forwardRef<HTMLDivElement, ITooltipDialogPr
ref
) => {
const theme = useContext(ThemeContext) || DEFAULT_THEME;
const environment = useDocument(theme);
const previousReferenceElementRef = useRef<HTMLElement | null>();
const modalRef = useRef<HTMLDivElement>(null);
const transitionRef = useRef<HTMLDivElement>(null);
Expand All @@ -76,7 +82,8 @@ const TooltipDialogComponent = React.forwardRef<HTMLDivElement, ITooltipDialogPr
modalRef,
focusOnMount,
/** Handle `restoreFocus` locally to return focus to `referenceElement` */
restoreFocus: false
restoreFocus: false,
environment
});

const [floatingPlacement, fallbackPlacements] = getFloatingPlacements(
Expand Down