Skip to content

Commit 11b8d4c

Browse files
authored
Dialog: Show Tooltip on "close" button (#5436)
Co-authored-by: TylerJDev <[email protected]>
1 parent 94bc6e4 commit 11b8d4c

File tree

33 files changed

+23
-17
lines changed

33 files changed

+23
-17
lines changed

.changeset/chilled-walls-cheer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Show `Tooltip` on close button in `Dialog`

packages/react/.storybook/storybook.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
border: var(--borderWidth-thin) solid var(--borderColor-sponsors-emphasis) !important;
7575
}
7676

77+
.testCustomAnimation {
78+
animation: none !important;
79+
}
80+
7781
.testCustomClassnameMono {
7882
font-family: var(--fontStack-monospace) !important;
7983
}

packages/react/src/Dialog/Dialog.dev.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const WithCss = ({width, height, subtitle}: DialogStoryProps) => {
8383
{buttonType: 'danger', content: 'Delete the universe', onClick: onDialogClose},
8484
{buttonType: 'primary', content: 'Proceed'},
8585
]}
86-
className="testCustomClassnameBorder"
86+
className="testCustomClassnameBorder testCustomAnimation"
8787
>
8888
{lipsum}
8989
</Dialog>
@@ -137,7 +137,7 @@ export const WithSx = ({width, height, subtitle}: DialogStoryProps) => {
137137
{buttonType: 'danger', content: 'Delete the universe', onClick: onDialogClose},
138138
{buttonType: 'primary', content: 'Proceed'},
139139
]}
140-
sx={{borderColor: 'accent.emphasis', borderWidth: '1px', borderStyle: 'solid'}}
140+
sx={{borderColor: 'accent.emphasis', borderWidth: '1px', borderStyle: 'solid', animation: 'none !important'}}
141141
>
142142
{lipsum}
143143
</Dialog>
@@ -199,7 +199,7 @@ export const WithSxAndCss = ({width, height, subtitle}: DialogStoryProps) => {
199199
{buttonType: 'danger', content: 'Delete the universe', onClick: onDialogClose},
200200
{buttonType: 'primary', content: 'Proceed'},
201201
]}
202-
sx={{borderColor: 'border.accent', borderWidth: '1px', borderStyle: 'solid'}}
202+
sx={{borderColor: 'border.accent', borderWidth: '1px', borderStyle: 'solid', animation: 'none !important'}}
203203
className="testCustomClassnameBorder"
204204
>
205205
{lipsum}

packages/react/src/Dialog/Dialog.module.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@
119119
}
120120

121121
@media screen and (prefers-reduced-motion: no-preference) {
122-
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
122+
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
123123
}
124124

125125
&[data-position-regular='center'] {
126126
border-radius: var(--borderRadius-large, var(--borderRadius-large));
127127

128128
@media screen and (prefers-reduced-motion: no-preference) {
129-
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
129+
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
130130
}
131131
}
132132

@@ -138,7 +138,7 @@
138138
border-bottom-left-radius: 0;
139139

140140
@media screen and (prefers-reduced-motion: no-preference) {
141-
animation: Overlay--motion-slideInRight 0.25s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
141+
animation: Overlay--motion-slideInRight 0.25s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
142142
}
143143
}
144144

@@ -193,7 +193,7 @@
193193
border-bottom-left-radius: 0;
194194

195195
@media screen and (prefers-reduced-motion: no-preference) {
196-
animation: Overlay--motion-slideUp 0.25s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
196+
animation: Overlay--motion-slideUp 0.25s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
197197
}
198198
}
199199

@@ -206,7 +206,7 @@
206206
flex-grow: 1;
207207

208208
@media screen and (prefers-reduced-motion: no-preference) {
209-
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
209+
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
210210
}
211211
}
212212
}

packages/react/src/Dialog/Dialog.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,14 @@ const StyledDialog = toggleStyledComponent(
271271
opacity: 1;
272272
273273
@media screen and (prefers-reduced-motion: no-preference) {
274-
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
274+
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
275275
}
276276
277277
&[data-position-regular='center'] {
278278
border-radius: var(--borderRadius-large, 0.75rem);
279279
280280
@media screen and (prefers-reduced-motion: no-preference) {
281-
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
281+
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
282282
}
283283
}
284284
@@ -290,7 +290,7 @@ const StyledDialog = toggleStyledComponent(
290290
border-bottom-left-radius: 0;
291291
292292
@media screen and (prefers-reduced-motion: no-preference) {
293-
animation: Overlay--motion-slideInRight 0.25s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
293+
animation: Overlay--motion-slideInRight 0.25s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
294294
}
295295
}
296296
@@ -323,7 +323,7 @@ const StyledDialog = toggleStyledComponent(
323323
border-bottom-left-radius: 0;
324324
325325
@media screen and (prefers-reduced-motion: no-preference) {
326-
animation: Overlay--motion-slideUp 0.25s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
326+
animation: Overlay--motion-slideUp 0.25s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
327327
}
328328
}
329329
@@ -336,7 +336,7 @@ const StyledDialog = toggleStyledComponent(
336336
flex-grow: 1;
337337
338338
@media screen and (prefers-reduced-motion: no-preference) {
339-
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running;
339+
animation: Overlay--motion-scaleFade 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1ms 1 normal none running;
340340
}
341341
}
342342
}
@@ -677,10 +677,7 @@ const Buttons: React.FC<React.PropsWithChildren<{buttons: DialogButtonProps[]}>>
677677
}
678678

679679
const CloseButton: React.FC<React.PropsWithChildren<{onClose: () => void}>> = ({onClose}) => {
680-
return (
681-
// eslint-disable-next-line primer-react/a11y-remove-disable-tooltip
682-
<IconButton unsafeDisableTooltip={true} icon={XIcon} aria-label="Close" onClick={onClose} variant="invisible" />
683-
)
680+
return <IconButton icon={XIcon} aria-label="Close" onClick={onClose} variant="invisible" />
684681
}
685682

686683
/**

0 commit comments

Comments
 (0)