Skip to content

fix(admin): replace raw checkboxes with Kumo Switch and Checkbox#952

Merged
ascorbic merged 2 commits into
mainfrom
fix/admin-checkbox-switch
May 8, 2026
Merged

fix(admin): replace raw checkboxes with Kumo Switch and Checkbox#952
ascorbic merged 2 commits into
mainfrom
fix/admin-checkbox-switch

Conversation

@ascorbic

@ascorbic ascorbic commented May 8, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Migrates the remaining 20 raw `<input type="checkbox">` elements across the admin UI to Kumo's `Switch` and `Checkbox` components. Single-boolean toggles become `Switch`; multi-select / list-context checkboxes become `Checkbox`. Drops manual `` wrappers and `h-4 w-4` styling that the Kumo components provide built-in.

Switches (single-boolean toggles)

File Toggles
`ContentTypeEditor.tsx` SEO, Enable comments, Auto-approve authenticated users
`RepeaterField.tsx` boolean sub-field
`PortableTextEditor.tsx` plugin 'toggle' field type renderer (DynamicSelect cousin)
`FieldEditor.tsx` Required / Unique / Searchable + sub-field Required (4 total)
`WordPressImport.tsx` Import navigation menus, Categories (locked-on), Tags (locked-on), Site title, Logo and favicon, SEO settings, per-post-type toggles (7 total)

Checkboxes (multi-select / list items)

File Use
`ContentTypeEditor.tsx` `supports[]` multi-select
`PluginManager.tsx` 'Also delete plugin storage data' uninstall option
`TaxonomyManager.tsx` Collection multi-select
`TaxonomySidebar.tsx` Term tree node checkboxes

Approach

  • Each replaced `...<input type="checkbox">...
    ` block becomes a single `` or `` with the label/description passed to the `label` prop (as a JSX node when the original had multi-line title + description).
  • `onChange={(e) => setX(e.target.checked)}` becomes `onCheckedChange={(checked) => setX(checked)}` (the boolean comes directly).
  • For locked-on indicators (WordPressImport's Categories/Tags), preserved `disabled` + `checked={true}` semantics.
  • Visual testing in the demo admin confirms all toggles render correctly with proper state binding, label rendering, and toggle interactivity.

Visual verification

Captured screenshots of:

  • Content Type editor (4 supports Checkboxes + 3 Switches: SEO, Enable comments — all rendering with title + description below)
  • Field editor dialog (Required/Unique/Searchable Switches — blue when on, neutral when off)
  • New Taxonomy dialog (Hierarchical Checkbox + Pages/Posts collection multi-select Checkboxes)
  • Click-tested toggling: SEO Switch flips on, Save button activates correctly; Preview Checkbox toggles to checked state

What's not in this PR

Out-of-scope follow-ups noted during testing:

  • Sticky-header rendering issue on ContentTypeEditor (header overlaps form content with transparency artifacts) — separate PR
  • WordPressImport step-2 toggles couldn't be visually verified without a real WP source site

Closes #

Type of change

  • Refactor (no behavior change)
  • Bug fix
  • Feature
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • `pnpm typecheck` passes
  • `pnpm lint` passes
  • `pnpm test` passes (admin: 861/861)
  • `pnpm format` has been run
  • I have added/updated tests for my changes — not applicable, all changes are 1:1 component substitutions; existing tests cover the rendered output. Verified visually with agent-browser screenshots.
  • User-visible strings are wrapped for translation
  • I have added a changeset
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.7 (orchestration) + Claude Haiku 4.5 (`simple-tasks` sub-agents) via OpenCode

Stack: `main` → #934 (merged) → #937 (merged) → #940 (merged) → #949 (merged) → #950 (merged) → this PR → (next: aria-labels) → (next: RTL safety) → (next: semantic tokens) → (last: ESLint enforcement)

Migrates 20 raw <input type="checkbox"> elements to Kumo:

Switches (single-boolean toggles with description):
- ContentTypeEditor: SEO, Enable comments, Auto-approve authenticated users
- RepeaterField: boolean sub-field
- PortableTextEditor: plugin 'toggle' field type renderer
- FieldEditor: Required / Unique / Searchable + sub-field Required
- WordPressImport: Import navigation menus, Categories (locked-on),
  Tags (locked-on), Site title and tagline, Logo and favicon, SEO
  settings, per-post-type toggles

Checkboxes (multi-select / list items):
- ContentTypeEditor: supports[] options
- PluginManager: 'Also delete plugin storage data' uninstall option
- TaxonomyManager: collection multi-select
- TaxonomySidebar: term tree nodes

Drops manual <label> wrappers and h-4 w-4 styling that Kumo provides
built-in. Visual testing confirms all toggles render correctly with
proper state binding and label/description rendering.
Copilot AI review requested due to automatic review settings May 8, 2026 14:05
@changeset-bot

changeset-bot Bot commented May 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7929f14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-perf-coordinator 7929f14 May 08 2026, 03:14 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-i18n 7929f14 May 08 2026, 03:15 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs 7929f14 May 08 2026, 03:15 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache 7929f14 May 08 2026, 03:16 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground 7929f14 May 08 2026, 03:16 PM

@pkg-pr-new

pkg-pr-new Bot commented May 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@952

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@952

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@952

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@952

emdash

npm i https://pkg.pr.new/emdash@952

create-emdash

npm i https://pkg.pr.new/create-emdash@952

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@952

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@952

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@952

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@952

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@952

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@952

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@952

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@952

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@952

commit: 7929f14

Copilot AI 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.

Pull request overview

Migrates remaining raw checkbox inputs in the admin UI to Kumo primitives, standardizing behavior/styling by using Switch for boolean toggles and Checkbox for multi-select/list contexts.

Changes:

  • Replaced multiple <input type="checkbox"> usages with Kumo Switch/Checkbox across key admin components.
  • Updated event handling from onChange(e.target.checked) to onCheckedChange(checked) to match Kumo APIs.
  • Added a changeset documenting the admin patch release for these UI substitutions.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/admin/src/components/WordPressImport.tsx Converts import-step toggles to Switch components.
packages/admin/src/components/TaxonomySidebar.tsx Replaces term-tree checkbox inputs with Kumo Checkbox.
packages/admin/src/components/TaxonomyManager.tsx Replaces collection multi-select checkbox inputs with Kumo Checkbox.
packages/admin/src/components/RepeaterField.tsx Converts boolean sub-field input to a Kumo Switch.
packages/admin/src/components/PortableTextEditor.tsx Converts BlockKit toggle field renderer to a Kumo Switch.
packages/admin/src/components/PluginManager.tsx Converts uninstall “delete data” option to a Kumo Checkbox.
packages/admin/src/components/FieldEditor.tsx Converts field property toggles (Required/Unique/Searchable) to Switch.
packages/admin/src/components/ContentTypeEditor.tsx Converts supports multi-select to Checkbox and settings toggles to Switch.
.changeset/better-cameras-smoke.md Adds a patch changeset describing the admin UI checkbox migration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/admin/src/components/WordPressImport.tsx
The previous raw <input type="checkbox"> had aria-label={t`Import ${name}`}
which was lost when converting to <Switch>. Restore it -- the visible label
text lives in a sibling <button> for the expand/collapse interaction, so the
Switch needs its own accessible name.

Spotted in PR review by Copilot.
@ascorbic ascorbic merged commit 131bea6 into main May 8, 2026
39 checks passed
@ascorbic ascorbic deleted the fix/admin-checkbox-switch branch May 8, 2026 15:27
@emdashbot emdashbot Bot mentioned this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants