Skip to content

Commit 12e25d3

Browse files
authored
Small table cell tooltip changes (#1967)
* Simplify cell tooltip labels and make them interactive * Re-add CellTooltip with stopPropagation
1 parent 52a75c7 commit 12e25d3

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

webview/src/experiments/components/App.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ describe('App', () => {
637637
const tooltip = screen.getByRole('tooltip')
638638
expect(tooltip).toBeInTheDocument()
639639

640-
expect(tooltip).toHaveTextContent(`Parameter: ${testParamStringValue}`)
640+
expect(tooltip).toHaveTextContent(testParamStringValue)
641641

642642
fireEvent.mouseLeave(testParamCell, { bubbles: true })
643643

@@ -665,9 +665,7 @@ describe('App', () => {
665665
jest.advanceTimersByTime(CELL_TOOLTIP_DELAY)
666666
const tooltip = screen.getByRole('tooltip')
667667
expect(tooltip).toBeInTheDocument()
668-
expect(tooltip).toHaveTextContent(
669-
`Metric: ${String(testMetricNumberValue)}`
670-
)
668+
expect(tooltip).toHaveTextContent(String(testMetricNumberValue))
671669
})
672670
})
673671

webview/src/experiments/util/buildDynamicColumns.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ const UndefinedCell = (
2222
</div>
2323
)
2424

25-
const groupLabels: Record<string, string> = {
26-
deps: 'Dep',
27-
metrics: 'Metric',
28-
params: 'Parameter'
29-
}
30-
3125
const CellTooltip: React.FC<{
3226
cell: Cell<Experiment, string | number>
3327
}> = ({ cell }) => {
34-
const {
35-
column: { group },
36-
value
37-
} = cell
28+
const { value } = cell
3829
return (
39-
<>
40-
{groupLabels[group as string]}: {value}
41-
</>
30+
<div
31+
role="textbox"
32+
tabIndex={0}
33+
onClick={e => {
34+
e.stopPropagation()
35+
}}
36+
onKeyDown={e => {
37+
e.stopPropagation()
38+
}}
39+
>
40+
{value}
41+
</div>
4242
)
4343
}
4444

@@ -62,6 +62,7 @@ const Cell: React.FC<Cell<Experiment, string | number>> = cell => {
6262
placement="bottom"
6363
arrow={true}
6464
delay={[CELL_TOOLTIP_DELAY, 0]}
65+
interactive={true}
6566
>
6667
<div className={styles.innerCell}>
6768
<CopyButton

webview/src/shared/components/tooltip/styles.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ $font: var(--vscode-font-family);
1717
white-space: nowrap;
1818
& > :global(.tippy-arrow) {
1919
color: $background;
20-
z-index: 2;
20+
z-index: 1;
2121
::before {
2222
overflow: hidden;
2323
}
@@ -27,6 +27,6 @@ $font: var(--vscode-font-family);
2727
white-space: nowrap;
2828
padding: 0;
2929
background-color: $background;
30-
z-index: 1;
30+
z-index: 2;
3131
}
3232
}

0 commit comments

Comments
 (0)