Skip to content

feat(prompts): keep the prompts table header and Prompt column pinned while scrolling - #1007

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/prompts-sticky-table-header
Oct 13, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/prompts-sticky-table-header

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

On the Tracked Prompts table ("All Prompts"), the column header scrolled off screen after about 20 rows, so it was no longer clear which number belonged to Mentions, Citations or Runs. This PR keeps the header row and the Prompt column pinned while the table scrolls.

  • components/ui/table.tsx: Table gets two opt-in props, stickyHeader and stickyFirstColumn. A sticky cell pins to its nearest scrolling ancestor, so a sticky table scrolls inside its own height-capped container (max-h-[calc(100dvh-12rem)] overflow-auto). That keeps both the header (vertical) and the first column (horizontal) pinned. Sticky cells get an opaque bg-card so rows don't show through. The first column repaints the row hover tint itself. A subtle shadow appears under the header (and beside the first column) only once the table has scrolled.
  • dashboard/prompts/page.tsx: the Tracked Prompts table turns both props on.
  • Tables that don't pass the props render exactly as before (overflow-x-auto, no sticky classes).

Because it lives in the shared component, the same behavior can be switched on later for other long tables (Content Opportunities, Action Center, Query Fan-out, Citations) with one prop.

Related issue

None. Product task PROMPT-011 ("Sticky column header in the prompts table").

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Open Prompts → Tracked Prompts for a brand with 30+ prompts.
  2. Scroll down inside the table: the header row stays at the top of the table, and rows scroll underneath it with a soft shadow.
  3. Make the window narrow enough that the table scrolls sideways: the Prompt column stays on the left.
  4. While pinned, sort by a column (e.g. Visibility) and hover an ⓘ tooltip: both still work, and the tooltip renders above the header.
  5. Check another table that uses Table (e.g. the prompt-suggestions table): no change.

Tested locally with 57 prompts (header and first column stay pinned, sorting and tooltips work while pinned).

Notes for reviewers

  • The table now scrolls inside its own box instead of the page, so the page has two scroll areas when the table is tall. That is what keeps both axes pinned. A page-level sticky header would need the container's overflow-x-auto removed, which breaks horizontal scrolling.
  • npm run version:check fails on main too (docker-compose images are 0.2.0 while the packages are 0.3.0). It is unrelated to this PR, so I left it alone.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

yarn test (470 passed, 4 new in components/ui/table.test.ts) and yarn build (with the CI placeholder env) also pass.

🤖 Generated with Claude Code

… while scrolling

With 100 prompts per page the column header scrolled out of view, so it was
hard to tell Mentions, Citations and Runs apart further down the list. The
shared Table component gains opt-in stickyHeader and stickyFirstColumn props,
and the Tracked Prompts table turns both on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk this is ready for review (PROMPT-011). Could you also approve the CI workflows so the checks can run?

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. Checked the build and the generated sticky and shadow CSS.

@gkhngyk
gkhngyk merged commit e80b083 into ansvisor:main Oct 13, 2026
6 checks passed
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