Repository navigation
fix(admin): introduce RouterLinkButton, fix invalid <Link><Button> HTML nesting - #949
Conversation
…tonVariants
<Link><Button>...</Button></Link> renders as <a><button>, which is invalid
HTML and breaks accessibility (screen readers see two interactive elements,
keyboard navigation is wrong). Use the documented pattern:
<Link className={buttonVariants(...)}>.
Extracts the duplicated <Link to="/settings"><Button variant="ghost"
shape="square"><ArrowPrev/></Button></Link> pattern into a shared
BackToSettingsLink component used by all 7 settings sub-pages.
Also fixes router.tsx ErrorScreen Retry button (raw <button> with manual
color classes -> Kumo Button).
Tests in PluginManager updated to query by role=link instead of
role=button (the element is now correctly a link, not a button).
…s usages
RouterLinkButton wraps TanStack Router's <Link> with Kumo button styling,
giving us a single component for router-aware buttons that fixes invalid
<a><button> nesting cleanly. Migrates the previous commit's
<Link className={buttonVariants(...)}> patterns plus 14 existing usages
across ContentEditor, ContentList, ContentTypeEditor, ContentTypeList,
MenuList, PluginManager, SectionEditor, SignupPage, InviteAcceptPage, and
BackToSettingsLink.
Implementation uses <Link> directly (not createLink()) because createLink
breaks tests that mock @tanstack/react-router as a stub anchor — the
mocked Link IS what we use, and our wrapper passes through props.
🦋 Changeset detectedLatest commit: e262c6d The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-perf-coordinator | e262c6d | May 08 2026, 11:04 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-i18n | e262c6d | May 08 2026, 11:05 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | e262c6d | May 08 2026, 11:05 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | e262c6d | May 08 2026, 11:07 AM |
Scope checkThis PR touches 21 files. PRs with a broad scope are harder to review. Please confirm the scope hasn't drifted beyond the intended change. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | e262c6d | May 08 2026, 11:06 AM |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Replaces the rambling 'Use Kumo Components' section with a clearer decision table for Button / LinkButton / RouterLinkButton / buttonVariants, and documents the new RouterLinkButton helper introduced in this PR. Net -13 lines.
There was a problem hiding this comment.
Pull request overview
Fixes invalid interactive-element nesting (<a><button>) in the admin UI by introducing a router-aware “button-styled link” component and migrating existing usages to it, improving semantics and accessibility across navigation actions.
Changes:
- Added
RouterLinkButton(TanStack Router<Link>composed with Kumo button styling) and migrated admin “link that looks like a button” usages to it. - Extracted a shared
BackToSettingsLinkand updated settings sub-pages to reuse it. - Updated the PluginManager test to assert correct link semantics; replaced a raw retry
<button>with Kumo<Button>in the router error screen.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/admin/src/components/RouterLinkButton.tsx | New reusable component to render a single <a> styled like a Kumo button for TanStack Router navigation. |
| packages/admin/src/components/settings/BackToSettingsLink.tsx | New shared “Back to settings” control for settings sub-pages using RouterLinkButton. |
| packages/admin/src/components/settings/ApiTokenSettings.tsx | Replaced nested <Link><Button> back control with BackToSettingsLink. |
| packages/admin/src/components/settings/AllowedDomainsSettings.tsx | Replaced nested <Link><Button> back control with BackToSettingsLink. |
| packages/admin/src/components/settings/EmailSettings.tsx | Replaced duplicated back-to-settings header link with BackToSettingsLink. |
| packages/admin/src/components/settings/GeneralSettings.tsx | Replaced duplicated back-to-settings controls (header + sticky header) with BackToSettingsLink. |
| packages/admin/src/components/settings/SeoSettings.tsx | Replaced duplicated back-to-settings controls (header + sticky header) with BackToSettingsLink. |
| packages/admin/src/components/settings/SecuritySettings.tsx | Replaced back-to-settings header control with BackToSettingsLink. |
| packages/admin/src/components/settings/SocialSettings.tsx | Replaced duplicated back-to-settings controls (header + sticky header) with BackToSettingsLink. |
| packages/admin/src/components/SignupPage.tsx | Replaced <Link><Button> login navigation buttons with RouterLinkButton. |
| packages/admin/src/components/InviteAcceptPage.tsx | Replaced <Link><Button> login navigation buttons with RouterLinkButton. |
| packages/admin/src/components/SectionEditor.tsx | Replaced back navigation <Link><Button> patterns with RouterLinkButton. |
| packages/admin/src/components/PluginManager.tsx | Migrated button-styled router links (Marketplace, Settings, etc.) to RouterLinkButton. |
| packages/admin/src/components/MenuList.tsx | Migrated “Edit” router link to RouterLinkButton. |
| packages/admin/src/components/ContentTypeList.tsx | Migrated “New Content Type” and edit icon links to RouterLinkButton. |
| packages/admin/src/components/ContentTypeEditor.tsx | Migrated “Back to Content Types” control to RouterLinkButton. |
| packages/admin/src/components/ContentList.tsx | Migrated “Add New” and row edit icon link to RouterLinkButton. |
| packages/admin/src/components/ContentEditor.tsx | Migrated back-to-list icon link to RouterLinkButton. |
| packages/admin/src/router.tsx | Replaced raw retry <button> styling with Kumo <Button> on the error screen. |
| packages/admin/tests/components/PluginManager.test.tsx | Updated assertions to query the settings control as a link (semantic fix). |
| .changeset/modern-maps-remain.md | Added changeset documenting the admin patch and component introduction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What does this PR do?
Fixes invalid
<a><button>HTML produced by<Link><Button>...</Button></Link>patterns across the admin UI, and introduces aRouterLinkButtoncomponent to make this kind of router-aware-button reusable.<Link><Button>renders as<a><button>, which is invalid HTML — screen readers see two interactive elements, keyboard navigation breaks, and the rendered DOM doesn't match the semantics the developer wrote.Approach
Two commits, intentionally separated for review clarity:
First commit: Initial fix using the documented
<Link className={buttonVariants(...)}>pattern. Also extracts the duplicated "Back to settings" header link into a sharedBackToSettingsLinkcomponent used by all 7 settings sub-pages, and fixes a raw<button>Retry control inrouter.tsxErrorScreen (which was using inlinebg-kumo-brand text-whiteclasses that bypassed Kumo's state styling).Second commit: Introduces a
RouterLinkButtoncomponent that wraps TanStack Router's<Link>with Kumo button styling (variant,size,shape,icon,classNameprops passing through). Migrates all 16+<Link className={buttonVariants(...)}>usages — both the ones added in the first commit and 10 pre-existing ones acrossContentEditor,ContentList,ContentTypeEditor,ContentTypeList,MenuList,PluginManager,SectionEditor, etc. — to use it. The result: a single, consistent way to render a router-aware button.Why not Kumo's
LinkButton+LinkProvider?Considered and rejected. Kumo's
LinkProviderwires a custom anchor component forLinkButton, but itsLinkComponentPropstype only accepts plain anchor attrs + optionalto: string. TanStack Router's typed routes requireparams,search,preload, etc. — props that don't fit through Kumo's provider interface. Going viaLinkProviderwould lose TanStack's type safety, link preloading, active states, and forces a runtime branching adapter.RouterLinkButtonkeeps the full TanStack RouterLinkAPI intact and just composes Kumo's button-variant classes onto it. Implementation note: I tried using TanStack'screateLink()helper first, but it broke the existing test suite (153 failures) because tests mock@tanstack/react-routeras a stub anchor andcreateLinkcallsuseRouter()internally which fails without the real router context. Using<Link>directly inside the wrapper means tests' existing mock substitutes correctly.Files changed
New:
packages/admin/src/components/RouterLinkButton.tsx— the componentpackages/admin/src/components/settings/BackToSettingsLink.tsx— shared back-to-settings linkMigrated (12 files):
ApiTokenSettings,GeneralSettings,SeoSettings,EmailSettings,SocialSettings,SecuritySettings,AllowedDomainsSettings) — useBackToSettingsLinkContentEditor,ContentList,ContentTypeEditor,ContentTypeList,SectionEditor)MenuList,PluginManager)SignupPage,InviteAcceptPage)router.tsx— Retry button → Kumo<Button>tests/components/PluginManager.test.tsx— query byrole=linkinstead ofrole=button(the element is now correctly a link)Closes #
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (admin: 858/858)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
No visual change —
RouterLinkButtonproduces the same Tailwind classes as the<Link className={buttonVariants(...)}>pattern. The fix is structural (DOM no longer has<a><button>), affecting screen readers and keyboard navigation rather than visible UI.Stack:
main→ #934 (merged) → #937 (merged) → #940 (merged) → this PR → (next: aria-labels) → (next: RTL safety) → (next: semantic tokens) → (last: ESLint enforcement)