Skip to content

Commit f4afd7e

Browse files
committed
fix(webapp): stop copy tooltip opening on whole-cell hover
The copy-cell tooltip was wired to a controlled `open` state that followed the whole cell's hover, so it popped open over neighbouring content whenever the pointer crossed any part of the cell instead of just the copy button. Leave the tooltip uncontrolled so Radix opens it only when the pointer or keyboard focus lands on the button itself; the button still stays permanently mounted so it keeps its place in the tab order.
1 parent 2856a6e commit f4afd7e

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

apps/webapp/app/components/code/TSQLResultsTable.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,9 +845,9 @@ function CopyableCell({
845845

846846
// The button (with its aria-label) always sits in the same position in the tree, wrapped by
847847
// the same SimpleTooltip, so it is never unmounted/remounted on hover (which would drop
848-
// keyboard focus). Only the tooltip's open state, not its mounted tree, follows hover; Radix
849-
// still only renders the (comparatively expensive) tooltip content into the DOM of this
850-
// virtualized grid while `open` is true.
848+
// keyboard focus). The tooltip is left uncontrolled so Radix opens it only when the pointer or
849+
// keyboard focus is actually on the button, not whenever the pointer is anywhere in this
850+
// virtualized grid's cell.
851851
const copyButton = (
852852
<button
853853
type="button"
@@ -889,7 +889,6 @@ function CopyableCell({
889889
<SimpleTooltip
890890
asChild
891891
tabbable
892-
open={isHovered}
893892
button={copyButton}
894893
content={copied ? "Copied!" : "Copy"}
895894
disableHoverableContent

apps/webapp/app/components/primitives/Table.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ export const CopyableTableCell = forwardRef<HTMLTableCellElement, CopyableTableC
480480

481481
// The button (with its aria-label) always sits in the same position in the tree, wrapped by
482482
// the same SimpleTooltip, so it is never unmounted/remounted on hover (which would drop
483-
// keyboard focus). Only the tooltip's open state, not its mounted tree, follows hover; Radix
484-
// still only renders the tooltip content into the DOM while `open` is true.
483+
// keyboard focus). The tooltip is left uncontrolled so Radix opens it only when the pointer
484+
// or keyboard focus is actually on the button, not whenever the pointer is anywhere in the cell.
485485
const copyButton = (
486486
<button
487487
type="button"
@@ -518,7 +518,6 @@ export const CopyableTableCell = forwardRef<HTMLTableCellElement, CopyableTableC
518518
<SimpleTooltip
519519
asChild
520520
tabbable
521-
open={isHovered}
522521
button={copyButton}
523522
content={copied ? "Copied!" : "Copy"}
524523
disableHoverableContent

0 commit comments

Comments
 (0)