Repository navigation
feat: unify SkipToContent across studio, docs, www, and design-system - #48314
Conversation
…ign-system Unify the skip-link treatment behind one opaque-backed default button, document it as a fragment, and adopt content-only main landmarks so Tab does not land in the sidebar.
Cover DefaultLayout, the home layout, and Go pages so keyboard users can jump past the sticky nav.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA shared ChangesSkip-to-content accessibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Keyboard
participant SkipToContent
participant MainLandmark
Keyboard->>SkipToContent: Tab to focus link
SkipToContent->>MainLandmark: Navigate to href target
MainLandmark->>MainLandmark: Receive focus and apply scroll offset
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR standardizes the “Skip to content” experience across the monorepo by introducing a shared SkipToContent component in packages/ui-patterns and adopting it in Studio, Docs, www, and the design-system. It also documents the pattern in the design-system docs and adds an example/demo fragment.
Changes:
- Added a shared
SkipToContentcomponent (with unit tests) toui-patternsand exposed it via package exports. - Updated Studio, Docs, www, and design-system layouts to render the shared skip link and ensure the target
<main>landmarks are focusable (tabIndex={-1}) and don’t show a focus outline (outline-hidden). - Added design-system documentation + fragment + registry demo for the skip-to-content pattern.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui-patterns/src/SkipToContent/SkipToContent.tsx | Introduces the shared skip-link component implementation. |
| packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx | Adds unit tests validating rendering and key styling/behavior contracts. |
| packages/ui-patterns/src/SkipToContent/index.tsx | Exports the component and props type via a local barrel. |
| packages/ui-patterns/package.json | Adds exports entries so consumers can import ui-patterns/SkipToContent. |
| apps/www/components/Layouts/Default.tsx | Adds the skip link to the www default layout and makes <main> a focusable target. |
| apps/www/components/Go/GoPageRenderer.tsx | Adds the skip link to Go pages and updates the <main> landmark contract. |
| apps/www/app/(home)/layout.tsx | Adds the skip link to the home app-router layout and updates the <main> target. |
| apps/studio/components/layouts/DefaultLayout.tsx | Replaces the local Studio skip link with the shared component and updates the <main> target. |
| apps/docs/layouts/MainSkeleton.tsx | Ensures the docs content container follows the “no visible outline on focus” contract. |
| apps/docs/components/SkipToContent.tsx | Removes the now-redundant docs-specific skip-to-content component. |
| apps/docs/app/layout.tsx | Switches docs to the shared SkipToContent and wires it to DOCS_CONTENT_CONTAINER_ID. |
| apps/design-system/registry/examples.ts | Registers a new design-system example for skip-to-content. |
| apps/design-system/registry/default/example/skip-to-content-demo.tsx | Adds the demo showcasing focused appearance and correct target landmark setup. |
| apps/design-system/content/docs/ui-patterns/navigation.mdx | Documents SkipToContent under navigation patterns and links to the fragment. |
| apps/design-system/content/docs/fragments/skip-to-content.mdx | Adds a reusable fragment documenting usage + landmark contract. |
| apps/design-system/content/docs/components/button.mdx | Updates Button docs description to explicitly include link-as-button usage. |
| apps/design-system/content/docs/accessibility.mdx | Adds guidance to use the shared skip-link fragment for persistent chrome layouts. |
| apps/design-system/config/docs.ts | Adds the new fragment to the design-system docs nav. |
| apps/design-system/app/(app)/layout.tsx | Adds the shared skip link and ensures <main> is content-only (sidebar stays outside). |
| apps/design-system/registry/index.tsx | Updates generated registry index to include the new skip-to-content demo. |
| apps/design-system/registry/default/block/chart-bar-interactive.tsx | Minor formatting-only change in a registry block file. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx (1)
23-32: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winExercise the Enter-to-focus behavior.
These assertions only inspect class strings; they do not verify the feature’s core interaction: tab to the link, press Enter, and focus the matching
<main>. Add a browser/component integration test with a real target landmark.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx` around lines 23 - 32, Add an integration test alongside the existing SkipToContent test that renders the component with a real main landmark matching its href, simulates keyboard tabbing to the skip link and pressing Enter, and asserts that the matching main element receives focus. Keep the existing class-name assertions unchanged.apps/studio/components/layouts/DefaultLayout.tsx (1)
98-98: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a Studio integration test for the landmark contract.
The shared component tests do not cover this layout wiring. Assert that the rendered link points to
#mainand thatmain#mainremainstabIndex={-1}so future layout changes cannot silently break the accessibility path.As per coding guidelines, include relevant tests by default and use Vitest for Studio changes.
Also applies to: 129-129
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/layouts/DefaultLayout.tsx` at line 98, Add a Vitest integration test for DefaultLayout that renders the layout and verifies SkipToContent links to `#main` and the main landmark is rendered as main#main with tabIndex={-1}. Place the assertions at the layout integration level rather than only testing the shared component.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/design-system/app/`(app)/layout.tsx:
- Line 27: Update the <main> element’s scroll-margin configuration in the layout
so its scroll offset matches the sticky TopNavigation height at each responsive
breakpoint. Reuse the shared header-height token if available, or apply
responsive scroll-mt values sufficient to keep the focused main content below
the header.
---
Nitpick comments:
In `@apps/studio/components/layouts/DefaultLayout.tsx`:
- Line 98: Add a Vitest integration test for DefaultLayout that renders the
layout and verifies SkipToContent links to `#main` and the main landmark is
rendered as main#main with tabIndex={-1}. Place the assertions at the layout
integration level rather than only testing the shared component.
In `@packages/ui-patterns/src/SkipToContent/SkipToContent.test.tsx`:
- Around line 23-32: Add an integration test alongside the existing
SkipToContent test that renders the component with a real main landmark matching
its href, simulates keyboard tabbing to the skip link and pressing Enter, and
asserts that the matching main element receives focus. Keep the existing
class-name assertions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 39063589-1a91-4073-b0b5-d703a2a28740
⛔ Files ignored due to path filters (2)
apps/design-system/__registry__/default/block/chart-bar-interactive.tsxis excluded by!apps/design-system/__registry__/**apps/design-system/__registry__/index.tsxis excluded by!apps/design-system/__registry__/**
📒 Files selected for processing (19)
apps/design-system/app/(app)/layout.tsxapps/design-system/config/docs.tsapps/design-system/content/docs/accessibility.mdxapps/design-system/content/docs/components/button.mdxapps/design-system/content/docs/fragments/skip-to-content.mdxapps/design-system/content/docs/ui-patterns/navigation.mdxapps/design-system/registry/default/example/skip-to-content-demo.tsxapps/design-system/registry/examples.tsapps/docs/app/layout.tsxapps/docs/components/SkipToContent.tsxapps/docs/layouts/MainSkeleton.tsxapps/studio/components/layouts/DefaultLayout.tsxapps/www/app/(home)/layout.tsxapps/www/components/Go/GoPageRenderer.tsxapps/www/components/Layouts/Default.tsxpackages/ui-patterns/package.jsonpackages/ui-patterns/src/SkipToContent/SkipToContent.test.tsxpackages/ui-patterns/src/SkipToContent/SkipToContent.tsxpackages/ui-patterns/src/SkipToContent/index.tsx
💤 Files with no reviewable changes (1)
- apps/docs/components/SkipToContent.tsx
scroll-mt-10 undershot TopNavigation; use scroll-mt-12 to align with the existing 3rem header assumption in this layout.
czenko
left a comment
There was a problem hiding this comment.
Love this 🤩
In hindsight, I should have promoted the SkipToContent from docs in the first place. Appreciate this change.
|
|
||
| [NavMenu component guidelines](../components/nav-menu) | ||
|
|
||
| ### SkipToContent |
There was a problem hiding this comment.
I'm looking for this content and can't find it 😅 What is the Preview URL?
There was a problem hiding this comment.
Looks so good 🤩 Documentation is very clear.
| <TopNavigation /> | ||
| <MobileSidebarSheet /> | ||
| <main className="flex-1 max-w-site mx-auto w-full border-l border-r border-b"> | ||
| <div className="flex-1 max-w-site mx-auto w-full border-l border-r border-b"> |
There was a problem hiding this comment.
Sidebar was on main, which means that “Skip to content” just skips to the sidebar. Not really semantic.
| <main id="main" tabIndex={-1} className="outline-hidden scroll-mt-12 min-w-0"> | ||
| {children} | ||
| </main> |
There was a problem hiding this comment.
...therefore main is now wrapping the actual content only.
| --- | ||
| title: Button | ||
| description: Displays a button or a component that looks like a button. | ||
| description: Displays a button or a link that looks like a button. |
There was a problem hiding this comment.
Extracted to shared component.
| tabIndex={-1} | ||
| className={cn( | ||
| 'w-full transition-all ease-out relative scroll-mt-(--header-height)', | ||
| 'w-full transition-all ease-out relative scroll-mt-(--header-height) outline-hidden', |
There was a problem hiding this comment.
Otherwise some browsers like Chrome will add the blue outline. main doesn’t need the outline, only (the next) interactive content.
| <Nav hideNavbar={false} /> | ||
| <div className="relative w-full"> | ||
| <main className="relative min-h-screen">{children}</main> | ||
| <main id="main" tabIndex={-1} className="relative min-h-screen scroll-mt-16 outline-hidden"> |
There was a problem hiding this comment.
tabIndex to be reachable, outline-hidden as explained above; to stop showing an outline.
| className={cn( | ||
| // Opaque plate so default Button muted/selection fills composite like any other control. | ||
| // w-fit: plate is a block div by default and would otherwise span the full content column. | ||
| 'fixed top-0 left-[10px] z-[100] w-fit rounded-md bg-background', |
There was a problem hiding this comment.
10px pixel values to line up visually in navigation bar on Studio and Docs.
🎭 Playwright Test Results (tanstack)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
kemaldotearth
left a comment
There was a problem hiding this comment.
Works as described across all 4 sites.
## What kind of change does this PR introduce? Bug fix for translucent default Button (and related control) fills that show through stacked content on hover. Resolves [DEPR-636](https://linear.app/supabase/issue/DEPR-636/report-snippet-cell-expand-button-becomes-transparent-on-hover). ## What is the current behavior? Default `Button` hover uses `bg-selection`, and dark-mode rest uses `bg-muted`. After the colour system migration those legacy aliases point at translucent `--accent` / `--muted`, so hover punches through whatever sits behind the button (SQL Editor / Reports cell expand, sticky columns, skip-to-content, etc.). | Before: Light | Before: Dark | | --- | --- | | <img width="491" height="75" alt="CleanShot 2026-08-03 at 09 12 26@2x" src="https://github.com/user-attachments/assets/20e33ba9-74c5-47eb-aced-ac932a0059fa" /> | <img width="205" height="54" alt="21257" src="https://github.com/user-attachments/assets/a2c9f092-18a7-4a4d-a49b-6e019e50895f" /> | ## What is the new behavior? Default Button, Select, MultiSelect, and the CommandMenu trigger use opaque elevation tokens (`bg-background dark:bg-card`, `hover:bg-popover`). SkipToContent drops its opaque-plate workaround. No global `compat.css` alias remaps. | After: Light | After: Dark | | --- | --- | | <img width="466" height="110" alt="CleanShot 2026-08-07 at 16 09 59@2x" src="https://github.com/user-attachments/assets/6410cb58-b37c-427f-a0ff-7b223a7f3f51" /> | <img width="474" height="132" alt="CleanShot 2026-08-07 at 16 08 53@2x" src="https://github.com/user-attachments/assets/575c56d1-8ee5-4eb5-8f08-e4b5af8520f0" /> | ## Additional context - Overlay tokens (`--muted` / `--accent` / `--tertiary`) stay intentional for washes on solid surfaces. Controls that can sit over content should use solid elevation tokens (`card` / `popover`) instead. - Same root cause as the workarounds in #47996 and #48314. - The “View full cell content” control lives in SQL Editor results / Report `QueryBlock` (`ResultCell`), not Table Editor. It only renders when the value is an object/array, contains a newline, or is longer than 60 characters, and it stays `opacity-0` until you hover the cell. ## To test Short path in Studio (light and dark): 1. **Expand button over cell text (clearest repro)** – SQL Editor, run: ```sql select repeat('x', 80) as name; ``` Hover the result cell. The expand control should appear over the text; hover the button itself and confirm the fill is solid (no `x`s showing through). Same control is what Report snippets use. 2. **Any default Button** – Top nav **Connect** (or any bordered default button). Hover: solid fill. 3. **Select** – Project picker or a Settings form select. Trigger hover / open fill stays opaque. 4. **Command menu trigger** – Hover the header search / Cmd-K control; match default Button. 5. **Skip to content** – Tab once on Studio. Skip link hover stays solid over the page behind it. 6. **Editor tabs regression** – SQL / Table Editor tab strip should still look grey in light mode (not washed white).
What kind of change does this PR introduce?
Feature / a11y polish
What is the current behavior?
Studio and Docs each had their own skip-to-content link (different styling and behaviour). www and design-system had none.
What is the new behavior?
Shared
SkipToContentinui-patterns, adopted by Studio, Docs, www, and design-system. Documented as a fragment with a short note under Accessibility → Jumping ahead.Tab once to reveal the button (top-left), Enter to jump to a content-only
<main>.To test
Shared steps for every app: enable Tab key navigation if needed, load the preview, press Tab once — skip button should slide in top-left. Press Enter — focus jumps to main content (no blue ring on
<main>). Press Tab again — first interactive control in the page body, not the sidebar/nav. Hover the skip button — solid fill, clear hover state, no chrome showing through.Additional context
Follow-up to #47694 / #48303 (Studio) and #47515 (Docs).
Summary by CodeRabbit
id="main").