Skip to content

Commit 4c90cd2

Browse files
authored
fix(website): fix tooltip on edit page (#6628)
resolves #6627 From claude: I found the root cause. It's a bug in react-tooltip v6's resolveDataTooltipAnchor function: ⏺ There's the bug. Line 259 checks currentElement instanceof HTMLElement — but SVG elements are SVGElement, not HTMLElement. So when data-tooltip-id is on the <MaterialSymbolsInfoOutline> (which renders as an <svg>), the library walks up the DOM tree and skips the SVG element entirely, never finding the anchor. The fix is to put data-tooltip-id on a wrapping <span> instead of on the SVG icon directly — exactly the pattern HoverTooltip already uses. ### Screenshot ### PR Checklist - [ ] All necessary documentation has been adapted. - [ ] The implemented feature is covered by appropriate, automated tests. - [ ] Any manual testing that has been done is documented (i.e. what exactly was tested?) 🚀 Preview: https://tooltip.loculus.org
1 parent fabc333 commit 4c90cd2

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

integration-tests/tests/specs/features/single-submit.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { expect } from '@playwright/test';
12
import { test } from '../../fixtures/group.fixture';
23
import { SingleSequenceSubmissionPage } from '../../pages/submission.page';
34

@@ -40,3 +41,20 @@ test('submit a single sequence, all in one method', async ({ page, groupId }) =>
4041
);
4142
await page.waitForURL('**/review');
4243
});
44+
45+
test('field description tooltip appears on hover', async ({ page, groupId }) => {
46+
void groupId;
47+
const submissionPage = new SingleSequenceSubmissionPage(page);
48+
await submissionPage.navigateToSubmissionPage();
49+
50+
// sampleCollectionDate has a definition and guidance in the config, so the info icon should be present
51+
const infoIcon = page.locator('[data-tooltip-id="field-tooltipsampleCollectionDate"]');
52+
await expect(infoIcon).toBeVisible();
53+
54+
await infoIcon.hover();
55+
56+
// The tooltip should become visible after the hover delay
57+
const tooltip = page.locator('#field-tooltipsampleCollectionDate');
58+
await expect(tooltip).toBeVisible({ timeout: 2000 });
59+
await expect(tooltip).toContainText('sampleCollectionDate');
60+
});

website/src/components/Edit/DataRow.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ export const EditableDataRow: FC<EditableRowProps> = ({ inputField, row, onChang
3939
{lastWord}
4040
{hasDescription && (
4141
<>
42-
<MaterialSymbolsInfoOutline
43-
className='inline-block h-4 w-4 text-gray-500 shrink-0 ml-1 mb-0.5'
42+
<span
43+
className='inline-block shrink-0 ml-1 mb-0.5'
4444
data-tooltip-id={'field-tooltip' + row.key}
45-
/>
45+
>
46+
<MaterialSymbolsInfoOutline className='h-4 w-4 text-gray-500' />
47+
</span>
4648
<InputFieldTooltip
4749
id={'field-tooltip' + row.key}
4850
field={inputField}

0 commit comments

Comments
 (0)