diff --git a/packages/core/src/Dialog/Dialog.stories.tsx b/packages/core/src/Dialog/Dialog.stories.tsx index f4329e59a0..1e47719e10 100644 --- a/packages/core/src/Dialog/Dialog.stories.tsx +++ b/packages/core/src/Dialog/Dialog.stories.tsx @@ -7,6 +7,7 @@ import React, { useState } from 'react' import { Box, Breadcrumbs, Button, Dialog, Grid, Text } from '..' import { argTypes, defaultArgs } from './Dialog.stories.args' +import { userEvent, within } from '@storybook/testing-library' type DialogStory = StoryObj @@ -19,6 +20,11 @@ const exampleHeaderProps: Partial = { export const Playground: DialogStory = { render: (args) => , + play: async ({ args, canvasElement }) => { + const canvas = within(canvasElement) + const openButton = canvas.getByText('Open Dialog') + await userEvent.click(openButton) + }, } export const WithHug: DialogStory = { diff --git a/packages/core/src/Dialog/Dialog.styled.tsx b/packages/core/src/Dialog/Dialog.styled.tsx index 59b947d3cd..41f6f53fca 100644 --- a/packages/core/src/Dialog/Dialog.styled.tsx +++ b/packages/core/src/Dialog/Dialog.styled.tsx @@ -53,6 +53,7 @@ const FloatingCloseButton: ( right: ${(props) => -((props.dialogSize === 'full' || props.fullWidth ? 0 : 16) + 10)}px; margin: ${(props) => themeGet('space.3')(props)}; padding: ${(props) => themeGet('space.2')(props)}; + z-index: ${(props) => themeGet('zIndices.absolute')(props)}; &:hover { background-color: ${(props) => themeGet('palette.background.lightest')(props)}; } @@ -168,6 +169,19 @@ export const DialogContent = ({ borderRadius={borderRadius} {...(sheet ? animationStyles.sheet : animationStyles.default)} > + {showCloseButton && ( + + + + )} + {ariaTitle} @@ -192,19 +206,6 @@ export const DialogContent = ({ )} {children} - - {showCloseButton && ( - - - - )} )