Database governance built for humans and agents — controlling changes and access across every major database.
BYT-9191 — Unified hover-tooltip for truncated names in React list tables
Linear: https://linear.app/bytebase/issue/BYT-9191
Problem
When a resource name/title is too long in a React list table, it is truncated with CSS ellipsis and the full text is unrecoverable — there is no hover affordance to reveal it. The Vue counterparts already show the full name on hover. The behavior is inconsistent across React list pages:
| Page | Name column | Tooltip on truncation? |
|---|---|---|
Instances (InstancesPage.tsx:1063) |
<EllipsisText text={instance.title} /> |
Yes |
Projects (ProjectTable.tsx:232-235) |
<HighlightLabelText text={project.title || resourceId} keyword={...} /> |
No (raw truncate) |
Databases (DatabaseTableView.tsx:164) |
<span className="truncate">{databaseName}</span> |
No (raw truncate) |
My Issues (IssueTable.tsx:645-654) |
<HighlightLabelText text={issue.title} ... /> inside truncate |
No |
A working component, EllipsisText (frontend/src/react/components/ui/ellipsis-text.tsx), already exists and is correct in principle (detects scrollWidth > clientWidth, shows tooltip only when actually truncated). Two problems block reuse on the other three tables:
- Its API only accepts a plain
text: string, so it cannot wrapHighlightLabelText(used by Projects and My Issues to highlight search-match substrings). - Its implementation violates the React overlay layering policy in
frontend/AGENTS.md: it portals directly todocument.bodyand uses rawz-50.
Goal
A single shared component owns "name cell that may truncate" behavior, used consistently across the four React list tables in scope. Hovering a truncated name reveals the full string in a tooltip after a short delay; when the cell is wide enough, no tooltip appears.
Non-goals
- Non-name columns in the same tables (address, environment, project label on Databases page, instance label on Databases page, etc.). They have the same raw-
truncateissue but are explicitly out of scope for this issue. - Other React list pages (environments, users, roles, etc.).
- Vue list pages — they already work correctly per the GIFs in BYT-9191.
- Renaming
EllipsisText.
Design
Component change: EllipsisText
File: frontend/src/react/components/ui/ellipsis-text.tsx
New API:
interface EllipsisTextProps {
readonly text: string; // tooltip content + default rendered text
readonly className?: string;
readonly children?: ReactNode; // optional: custom rendered content (e.g. <HighlightLabelText>)
}
Rendering:
- Renders a truncation container:
<span className={cn("block truncate", className)} ref={...}>. - If
childrenis provided, renderchildreninside the container; otherwise rendertext. - The tooltip popup always uses
text(the source-of-truth string).
Overflow detection:
- A
ResizeObserveron the container tracksscrollWidth > clientWidthand sets localisTruncatedstate. - Re-runs on first paint and on any container resize (e.g. column drag, viewport resize).
Tooltip:
- Use Base UI tooltip primitives directly (
@base-ui/react/tooltip):Provider,Root,Trigger,Portal,Positioner,Popup. - The shared
Tooltipwrapper inui/tooltip.tsxis not reused: its trigger is<span className="inline-flex" />, which breaksblock truncateinside flex/table cells.EllipsisTextneeds the truncation container itself to be the trigger, rendered viaBaseTooltip.Trigger'srenderprop. - Portal target:
getLayerRoot("overlay")(resolves the overlay layering-policy violation in the current implementation). - Positioner uses
LAYER_SURFACE_CLASS. - Popup uses semantic tokens (
bg-main,text-main-text, etc.) — same style as the sharedTooltipfor visual consistency. - The tooltip is suppressed when
!isTruncatedby settingopen={false}onBaseTooltip.Rootin that case, leaving it uncontrolled otherwise. - Hover delay:
delay={300}on theProvider. Standard hover-affordance delay; matches typical "title-attribute"-style behavior.
What goes away:
createPortal(..., document.body).- Raw
z-50. - Manual
mouseenter/mouseleavehandlers andposstate — Base UI's positioner handles placement.
Call-site changes
| File | Change |
|---|---|
frontend/src/react/pages/settings/InstancesPage.tsx:1063 |
No change — already uses EllipsisText. Confirms the API is backward-compatible. |
frontend/src/react/components/project/ProjectTable.tsx:232-235 |
Wrap HighlightLabelText with EllipsisText. Pass text={displayTitle} to EllipsisText; pass the same string + keyword to HighlightLabelText as children. |
frontend/src/react/components/database/DatabaseTableView.tsx:164 |
Replace the raw <span className="truncate"> with <EllipsisText text={databaseName} />. |
frontend/src/react/components/issue/IssueTable.tsx:645-654 |
Same pattern as ProjectTable — wrap HighlightLabelText with EllipsisText. Drop the outer truncate (EllipsisText already applies it). |
Call-site pattern for highlighted name cells:
const displayTitle = project.title || resourceId;
return (
<EllipsisText text={displayTitle}>
<HighlightLabelText text={displayTitle} keyword={keyword} />
</EllipsisText>
);
Why not the alternatives
- Add a
truncateprop toHighlightLabelText. Splits truncation behavior across two components —EllipsisTextfor plain-string cells,HighlightLabelTextfor highlighted ones. Two code paths means two opportunities for drift. - Build a new
TruncatedCellprimitive. No real gain over option above; replaces a working component with a new one and adds churn at the existing Instances call site.
Risk
Low. One shared component change with a backward-compatible API extension (new optional children prop) plus three small call-site changes. The EllipsisText rewrite to use the shared overlay layer is a behavioral improvement that's already mandated by the layering policy — fixing it now closes an existing violation.
Testing
Manual on each of the 4 tables (Instances, Projects, Databases, My Issues):
- Find a row with a long name. Tooltip appears on hover (~300ms delay) showing the full name.
- Resize the column wider until the name no longer truncates. Tooltip no longer appears on hover.
- For Projects and My Issues: type a keyword that matches part of a long name. The highlight still renders inside the truncated cell, and the tooltip still shows the full plain text.
Automated:
pnpm --dir frontend type-check.pnpm --dir frontend fixandpnpm --dir frontend check.node frontend/scripts/check-react-layering.mjs— must pass (verifies the body-portal and rawz-50removal).pnpm --dir frontend test—EllipsisTextdoes not currently have a unit test. No new test required for this change; existing tests must continue to pass.
Open questions
None.