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
134 changes: 121 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('ColorPickerDialog', () => {

await user.keyboard('{escape}');

expect(onDialogChange).toHaveBeenCalledTimes(2);
expect(onDialogChange).toHaveBeenCalledTimes(3);
expect(onDialogChange).toHaveBeenCalledWith({ isOpen: false });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('ColorSwatchDialog', () => {

await user.keyboard('{escape}');

expect(onDialogChange).toHaveBeenCalledTimes(2);
expect(onDialogChange).toHaveBeenCalledTimes(3);
expect(onDialogChange).toHaveBeenCalledWith({ isOpen: false });
});

Expand Down
2 changes: 1 addition & 1 deletion packages/modals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"types": "dist/typings/index.d.ts",
"dependencies": {
"@floating-ui/react-dom": "^2.0.0",
"@zendeskgarden/container-modal": "^1.0.15",
"@zendeskgarden/container-modal": "^1.0.21",
"@zendeskgarden/container-utilities": "^2.0.0",
"@zendeskgarden/react-buttons": "^9.12.1",
"dom-helpers": "^5.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,36 +264,24 @@ describe('TooltipDialog', () => {
expect(getByTestId('backdrop')).toHaveAttribute('aria-hidden', 'true');

// Open
await act(async () => {
await user.click(trigger);
});
await user.click(trigger);

const openDialog = getByRole('dialog');
expect(openDialog).toBeInTheDocument();
expect(getByTestId('backdrop')).not.toHaveAttribute('aria-hidden');
expect(openDialog).toHaveFocus();

expect(openDialog).not.toBeNull();

// Backdrop should NOT have hideVisually styles when visible
const visibleBackdropStyles = window.getComputedStyle(getByTestId('backdrop'));

expect(visibleBackdropStyles.position).toBe('fixed');

// Close (toggle button again)
await act(async () => {
await user.click(trigger);
});
await user.click(trigger);

// Dialog remains mounted but visually hidden again
const hiddenAgainDialog = queryByRole('dialog', { hidden: true });

// Dialog remains mounted but visually hidden again
expect(hiddenAgainDialog).not.toBeNull();
await waitFor(() => {
expect(getByTestId('backdrop')).toHaveAttribute('aria-hidden', 'true');
// Backdrop should have hideVisually styles applied again
const hiddenBackdropStyles = window.getComputedStyle(getByTestId('backdrop'));
expect(hiddenBackdropStyles.position).toBe('absolute');
expect(hiddenBackdropStyles.width).toBe('1px');
expect(hiddenBackdropStyles.height).toBe('1px');
});
// Focus should return to trigger
expect(trigger).toHaveFocus();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ const TooltipDialogComponent = React.forwardRef<HTMLDivElement, ITooltipDialogPr
$placement={placement}
$hasArrow={hasArrow}
$isAnimated={isAnimated}
inert={isHidden ? '' : undefined}
{...modalProps}
{...ariaProps}
{...props}
Expand Down
1 change: 1 addition & 0 deletions packages/modals/src/styled/StyledTooltipDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface IStyledTooltipDialogProps {
$isAnimated?: boolean;
$placement: Placement;
$transitionState?: TransitionStatus;
inert?: string;
}

const sizeStyles = (props: ThemeProps<DefaultTheme>) => `
Expand Down