Skip to content

fix(project-selector): move row tooltip to right side; simplify content - #2675

Open
Sebastian-ubs wants to merge 2 commits into
paranext:mainfrom
Sebastian-ubs:fix/project-selector-row-tooltip-side-and-content
Open

fix(project-selector): move row tooltip to right side; simplify content#2675
Sebastian-ubs wants to merge 2 commits into
paranext:mainfrom
Sebastian-ubs:fix/project-selector-row-tooltip-side-and-content

Conversation

@Sebastian-ubs

@Sebastian-ubs Sebastian-ubs commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Two changes to the row tooltip inside <ProjectSelector>'s popover:

1. Anchor moves from top to right

side=\"top\" frequently overlapped the row directly above (or the search bar for the topmost row). side=\"right\" puts the tooltip clear of the popover's content column and reads as a canonical row-details affordance. Alignment shifts from text-center to text-start to match side-anchored tooltip convention.

2. Content is restructured into three simple rows

Old content was a bold full name, then a couple of case-specific conditional lines. New content is a fixed three-row layout (with an optional fourth row for a disabled reason):

  • Full name — bold, first row.
  • Language — with (languageCode) muted in parentheses when both are present. Handles partial data (language-only or languageCode-only rows still render sensibly with no stray parenthesis).
  • Scroll group — one line that covers every case the row can be in:
    • bound-but-closed rows: caller's boundButClosedTooltip template with the letter substituted, rendered italic.
    • open-tab rows (project-multi / projectScrollGroup modes with a scrollGroupId): {scrRefLabel} ({letter}) when the caller supplied a scripture-ref label, else just the letter.
    • project-mode rows: comma-joined letters of all open scroll groups (A, B), mirroring the chip strip on the row.
  • Disabled reason — retained as a muted-italic fourth row when present. Surfaces information not otherwise visible on the row.

Test plan

  • Storybook → Advanced/Project Selector: hover rows in every story (SingleProject, MultiProject, ScrollGroupBinding, PerRowDisabled, NoProjects). Tooltip anchors right of the row, doesn't overlap the row above.
  • SingleProject: hover a row whose language and languageCode are both set → tooltip shows English (en-US). Hover a row with a scroll group open → tooltip shows the letter list. Truncate the container so the row text clips — tooltip still opens on hover (unchanged truncation-open behaviour).
  • ScrollGroupBinding: close a tab to force a bound-but-closed row → its tooltip's scroll-group line renders italic with the caller's boundButClosedTooltip string.
  • PerRowDisabled: hover a disabled row → the muted italic disabledReason still surfaces on its own line under the scroll-group line.
  • npm --workspace lib/platform-bible-react run test -- --run src/components/advanced/project-selector/ — 53 tests pass.
  • npm --workspace lib/platform-bible-react run lint — clean.

Relation to other in-flight PRs

Touches the same file as #2672 (z-index fix) and #2673 (grouping options). Based on main, so this PR is independent and can merge in any order — expect a small mechanical rebase against whichever of those merges last.

AI-assisted.


This change is Reviewable

before
image

after

Screenshot 2026-08-13 193528 Screenshot 2026-08-13 193517 Screenshot 2026-08-13 193511

The row tooltip in <ProjectSelector>'s popover previously anchored to
side="top", which routinely overlapped the row above (or the search bar
for the topmost row). Move it to side="right" so it sits clear of the
popover's content column and reads as a canonical row-details affordance.

Content is also simplified to three rows of straightforward information:

* Bold full name.
* Language, with `(languageCode)` muted in parentheses when both are
  present. Handles partial data — only-code or only-language rows still
  render sensibly, no stray parenthesis.
* Scroll group — single line covering every case:
  * bound-but-closed rows: caller's `boundButClosedTooltip` template
    (letter substituted), italic
  * open-tab rows: `{scrRefLabel} ({letter})` when a ref label is
    available, else the letter alone
  * `project`-mode rows: comma-joined letters of all open scroll groups
    (mirrors the chip strip on the row)

Disabled reason is retained as a fourth muted-italic row for accessibility
— it surfaces information not otherwise visible on the row.

Alignment shifts from `text-center` to `text-start` to match a
side-anchored tooltip convention.

Co-authored-by: Claude <noreply@anthropic.com>
…nd arrow

Two follow-ups to the row tooltip change:

* shadcn's TooltipContent applies `inline-flex items-center gap-1.5`
  to its content wrapper (`shadcn-ui/tooltip.tsx:96`), so sibling
  <div>s were laying out as horizontal columns. Add
  `flex-col items-start gap-0.5` to the local className so the info
  lines (full name / language / scroll group / disabled reason) stack
  vertically as intended.

* shadcn's TooltipContent arrow is a rotate-45 square that gets clipped
  to a triangle for side=top/bottom via clip-path. For side=left/right
  the wrapper's own comment (`shadcn-ui/tooltip.tsx:122-128`) documents
  that no clip-path is applied — "no consumer today needs a bordered
  left/right arrow" — so it renders as an unclipped diamond that pokes
  through the tooltip as a small rectangle. Pass `showArrow={false}`
  on this tooltip; the relationship to the hovered row is clear from
  position and hover-open behaviour.

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant