Skip to content

Commit 8c5b474

Browse files
fix(profile): prevent ProfileTooltip from opening on keyboard focus (#6051)
1 parent b0d66ee commit 8c5b474

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

packages/shared/src/components/profile/ProfileTooltip.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,14 @@ describe('ProfileTooltip', () => {
101101
const [props] = mockSimpleTooltipSpy.mock.calls[0] as [TooltipProps];
102102
expect(props.content).toBeTruthy();
103103
});
104+
105+
it('only triggers on mouseenter ( not keyboard focus ) for WCAG 3.2.1', () => {
106+
render(
107+
<ProfileTooltip userId="user-1">
108+
<button type="button">User</button>
109+
</ProfileTooltip>,
110+
);
111+
const [props] = mockSimpleTooltipSpy.mock.calls[0] as [TooltipProps];
112+
expect(props.trigger).toBe('mouseenter');
113+
});
104114
});

packages/shared/src/components/profile/ProfileTooltip.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export function ProfileTooltip({
163163
) : undefined,
164164
plugins:
165165
onTooltipMouseEnter || onTooltipMouseLeave ? [hoverPlugin] : undefined,
166+
trigger: 'mouseenter',
166167
...tooltip,
167168
onShow: (instance) => {
168169
logEvent({

0 commit comments

Comments
 (0)