Skip to content

Commit 542bd51

Browse files
rahulchhabriacursoragentgetsantry[bot]
authored andcommitted
Fix tool tips for question mark icons (#14084)
Tooltips were not appearing in Firefox 139.0 for question mark icons due to a known compatibility issue with Radix UI's `Tooltip.Trigger` when using the `asChild` prop, affecting Firefox's event handling and CSS animations. To resolve this: * In `src/components/onboarding/index.tsx`: * Explicit `onMouseEnter`, `onMouseLeave`, `onFocus`, and `onBlur` handlers were added to `Tooltip.Trigger` to manually manage the `data-state` attribute, ensuring Firefox correctly recognizes the tooltip's active state. * The `QuestionMarkCircledIcon` was wrapped in a `<span>` with `role="button"`, `tabIndex={0}`, and `aria-label` for improved accessibility and keyboard navigation. * `delayDuration={300}` was added to `Tooltip.Provider`, and `align="center"`, `side="top"` to `Tooltip.Content` for consistent timing and positioning. * In `src/components/onboarding/styles.module.scss`: * Firefox-specific CSS properties (`z-index`, `position`, `pointer-events`, `-moz-user-select`, `-webkit-user-select`, `-moz-animation-duration`, `-moz-animation-timing-function`) were added to `.TooltipContent`. * `-moz-animation-name` was applied to existing animation rules, and `-moz-keyframes` were defined for all slide animations to ensure proper rendering and animation in Firefox. These changes ensure tooltips now appear correctly in Firefox 139.0, while maintaining cross-browser compatibility and accessibility standards. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 56afddc commit 542bd51

File tree

2 files changed

+108
-4
lines changed

2 files changed

+108
-4
lines changed

src/components/onboarding/index.tsx

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,49 @@ export function OnboardingOptionButtons({
320320

321321
{optionDetails[option.id].name}
322322
{optionDetails[option.id] && (
323-
<Tooltip.Provider>
323+
<Tooltip.Provider delayDuration={300}>
324324
<Tooltip.Root>
325-
<Tooltip.Trigger asChild>
326-
<QuestionMarkCircledIcon fontSize={20} strokeWidth="2" />
325+
<Tooltip.Trigger
326+
asChild
327+
onMouseEnter={e => {
328+
// Explicit mouse enter handling for Firefox compatibility
329+
e.currentTarget.setAttribute('data-state', 'delayed-open');
330+
}}
331+
onMouseLeave={e => {
332+
// Explicit mouse leave handling for Firefox compatibility
333+
e.currentTarget.removeAttribute('data-state');
334+
}}
335+
onFocus={e => {
336+
// Ensure keyboard navigation works
337+
e.currentTarget.setAttribute('data-state', 'delayed-open');
338+
}}
339+
onBlur={e => {
340+
// Ensure keyboard navigation works
341+
e.currentTarget.removeAttribute('data-state');
342+
}}
343+
>
344+
<span
345+
role="button"
346+
tabIndex={0}
347+
aria-label={`Help: ${optionDetails[option.id].name}`}
348+
style={{
349+
display: 'inline-flex',
350+
alignItems: 'center',
351+
cursor: 'help',
352+
outline: 'none',
353+
}}
354+
>
355+
<QuestionMarkCircledIcon fontSize={20} strokeWidth="2" />
356+
</span>
327357
</Tooltip.Trigger>
328358
<Tooltip.Portal>
329359
<Theme accentColor="iris">
330-
<Tooltip.Content className={styles.TooltipContent} sideOffset={5}>
360+
<Tooltip.Content
361+
className={styles.TooltipContent}
362+
sideOffset={5}
363+
align="center"
364+
side="top"
365+
>
331366
{optionDetails[option.id].description}
332367
<Tooltip.Arrow className={styles.TooltipArrow} />
333368
</Tooltip.Content>

src/components/onboarding/styles.module.scss

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222
box-shadow: var(--shadow-6);
2323
animation-duration: 100ms;
2424
animation-timing-function: ease-in;
25+
/* Firefox-specific fixes */
26+
z-index: 9999;
27+
position: relative;
28+
pointer-events: none;
29+
30+
/* Ensure proper rendering in Firefox */
31+
-moz-user-select: none;
32+
-webkit-user-select: none;
33+
34+
/* Firefox animation support */
35+
-moz-animation-duration: 100ms;
36+
-moz-animation-timing-function: ease-in;
2537
}
2638

2739
.TooltipTitle {
@@ -35,15 +47,19 @@
3547

3648
.TooltipContent[data-state='delayed-open'][data-side='top'] {
3749
animation-name: slideDownAndFade;
50+
-moz-animation-name: slideDownAndFade;
3851
}
3952
.TooltipContent[data-state='delayed-open'][data-side='right'] {
4053
animation-name: slideLeftAndFade;
54+
-moz-animation-name: slideLeftAndFade;
4155
}
4256
.TooltipContent[data-state='delayed-open'][data-side='bottom'] {
4357
animation-name: slideUpAndFade;
58+
-moz-animation-name: slideUpAndFade;
4459
}
4560
.TooltipContent[data-state='delayed-open'][data-side='left'] {
4661
animation-name: slideRightAndFade;
62+
-moz-animation-name: slideRightAndFade;
4763
}
4864

4965
.TooltipArrow {
@@ -93,3 +109,56 @@
93109
transform: translateX(0);
94110
}
95111
}
112+
113+
/* Firefox-specific keyframe animations */
114+
@-moz-keyframes slideUpAndFade {
115+
from {
116+
opacity: 0;
117+
-moz-transform: translateY(2px);
118+
transform: translateY(2px);
119+
}
120+
to {
121+
opacity: 1;
122+
-moz-transform: translateY(0);
123+
transform: translateY(0);
124+
}
125+
}
126+
127+
@-moz-keyframes slideRightAndFade {
128+
from {
129+
opacity: 0;
130+
-moz-transform: translateX(-2px);
131+
transform: translateX(-2px);
132+
}
133+
to {
134+
opacity: 1;
135+
-moz-transform: translateX(0);
136+
transform: translateX(0);
137+
}
138+
}
139+
140+
@-moz-keyframes slideDownAndFade {
141+
from {
142+
opacity: 0;
143+
-moz-transform: translateY(-2px);
144+
transform: translateY(-2px);
145+
}
146+
to {
147+
opacity: 1;
148+
-moz-transform: translateY(0);
149+
transform: translateY(0);
150+
}
151+
}
152+
153+
@-moz-keyframes slideLeftAndFade {
154+
from {
155+
opacity: 0;
156+
-moz-transform: translateX(2px);
157+
transform: translateX(2px);
158+
}
159+
to {
160+
opacity: 1;
161+
-moz-transform: translateX(0);
162+
transform: translateX(0);
163+
}
164+
}

0 commit comments

Comments
 (0)