Skip to content

feat(sdk): info popover for plan features - #2055

Draft
Shreyag02 wants to merge 2 commits into
mainfrom
feat/plans-feature-info
Draft

Shreyag02 wants to merge 2 commits into
mainfrom
feat/plans-feature-info

Conversation

@Shreyag02

Copy link
Copy Markdown
Contributor

Summary

The Plans page can now show an info (i) icon next to a feature label. Hovering, clicking or pressing Enter on it opens a popover with an explanation, which can include links.

The text comes from the feature's metadata.info, which ListFeatures already returns. No API or proto change is needed. Features without metadata.info render exactly as before: the table markup is identical to main.

This also fixes a crash: a number or boolean in a plan's feature metadata made the whole Plans page throw, because the cell value was lowercased without checking its type.

Writing metadata.info is handled by #2045 and #2046 (the BillingFeature reconcile kind).

Screenshots

Before (no metadata.info) After
Popover, light Popover, dark

Cell values that used to crash the page:

Changes

Change Why Where
Read metadata.info and show an (i) icon with a popover Explain features in place, driven only by data feature-table.tsx, new feature-info.tsx
Parse [label](url) links in the info text Tooltips need links (docs, support email) helpers/feature-rows.ts
Convert cell values to strings before comparing A number or boolean value crashed the page FeatureValueCell
Move row building out of PlansView into a pure helper Testable without a browser; ordering kept identical to the old inline sort plans-view.tsx, helpers/feature-rows.ts
Popover and trigger styles 360px max width, scrolls past min(60vh, 400px), keeps line breaks, wraps long tokens feature-table.module.css
Jest tests for the three helpers Ordering, info handling, link parsing, value conversion helpers/feature-rows.test.ts

Technical Details

Topic Detail
Data contract metadata.info is a string. It shows only if it's non-blank after trimming. Non-string values are ignored.
Links Only [label](url) with a non-blank label and an http:, https: or mailto: URL becomes a link. Everything else, including javascript:, relative URLs, HTML and malformed markdown, is shown as plain text exactly as written. There's no dangerouslySetInnerHTML and no new dependency.
Link behaviour http(s) links open in a new tab (rel="noopener noreferrer"); mailto: links don't. Links are underlined, so they don't rely on colour alone.
Row ordering Rows are built with a plain object keyed by title, like the old code, so the order matches main exactly, including the rare case of integer-like titles with equal weightage. A differential check against the old logic over 100,000 random inputs found no differences.
!important in .infoContent The SDK injects its CSS before the host app loads Apsara's stylesheet, so Apsara's .popover wins equal-specificity ties. Without !important the popover is capped at 288px and its overflow: hidden stops long text from scrolling. This follows the existing pattern in delete-user-dialog.module.css.
Accessibility The trigger is a <button> named "More information about {title}", with aria-haspopup="dialog" and aria-expanded. The popover is a dialog named "About {title}". It's described by its own text through aria-describedby, so a screen reader reads the explanation and not only the first link that gets focus. Enter moves focus to the first link, Escape closes and returns focus to the icon, and prefers-reduced-motion turns off the animation.
Hover then click This is Base UI's behaviour: a click within 500ms of a hover-open keeps the popover open, and a later click closes it.

Test Plan

  • Jest: 16/16 helper tests pass. Each new test fails when the fix it covers is reverted.
  • Lint: 0 errors. tsc --noEmit reports the same 20 errors as main, with an identical list and none in these files. pnpm build passes.
  • Browser checks in headless Chrome against the real components, with Apsara's CSS loaded in the same order as the host app:
    • markup identical to main when no feature has info
    • opens on hover, click and Enter; Escape and clicking outside close it; focus returns to the icon
    • links open in the right place; unsafe and malformed links stay plain text
    • number and boolean values render; false, 0, empty and missing values show -
    • 360px max width, long text scrolls, line breaks kept, long tokens wrap
    • icon is 16×16, centred, and keeps its size next to a truncated title
    • light and dark themes; at the top of the screen the popover flips below the icon
  • A pass against a real backend with metadata.info set. Needs feat(reconcile): add BillingFeature kind #2046 or a manual UpdateFeature.

Known issues (not changed here)

Issue Notes
On narrow layouts, the table hides labels and icons The label column is flex: 1; min-width: 0, and the plan columns are a fixed 272px each, so the labels collapse to 0px when the table is narrower than about 816px plus padding. In the demo app, with its sidebar, that's a window below roughly 1,130–1,150px. Labels already disappear on main; now the icons disappear with them. To be fixed in a follow-up.
Dark theme link contrast Apsara's default link colour on the popover background measures 3.63:1, below the 4.5:1 that WCAG AA needs for small text. The underline gives a non-colour cue; the colour itself is an Apsara token.
URLs containing ) [x](https://…/Foo_(bar)) links to …Foo_(bar. Docs and support URLs don't use parentheses.
Object or array cell values These render as [object Object] or 1,2 instead of crashing. Only strings, numbers and booleans are expected.
Extra Tab stop after a hover-open Base UI inserts a focus guard, so the first Tab from the icon lands on a hidden element. Enter-open is not affected.

- Show an info icon with a popover for features that have metadata.info
- Parse [label](url) links in info; only http, https and mailto become links
- Fix crash when a feature cell value is a number or boolean
- Move feature row building into a pure helper with tests
- Make max-width and scrolling win over Apsara's popover styles
- Keep row ordering identical to the previous inline sort
- Describe the popover with its text for screen readers
- Underline links, keep line breaks, cap height, ignore blank link labels
- Simplify the info parser and test what it shows
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
frontier Ready Ready Preview Nov 16, 2026 4:57am UTC

@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 43807150373

Coverage remained the same at 56.053%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 42189
Covered Lines: 23648
Line Coverage: 56.05%
Coverage Strength: 19.7 hits per line

💛 - Coveralls

@Shreyag02 Shreyag02 self-assigned this Nov 16, 2026

This branch was successfully deployed

1 active deployment
Preview — 1f44a6ee Deployed Nov 15, 2026 by vercel[bot]
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.

2 participants