Skip to content

feat(admin): replace distraction-free mode with a settings panel toggle - #4779

Open
khoinguyenpham04 wants to merge 4 commits into
mainfrom
noah/editor-panel-toggle-2fa587
Open

khoinguyenpham04 wants to merge 4 commits into
mainfrom
noah/editor-panel-toggle-2fa587

Conversation

@khoinguyenpham04

Copy link
Copy Markdown
Collaborator

What does this PR do?

On desktop the content editor's settings panel is always open, so the page gets whatever width is left. On a 1024px screen that is about 400px. This PR adds a button at the end of the editor bar that hides the panel. The page then centers in the full width, and a second click shows the panel again. Because the panel can now be hidden, the maintainers agreed to remove distraction-free mode, which put one more button in an already busy bar.

What changed

  • A new toggle hides and shows the settings panel on screens 1024px and wider. The panel starts open, so nothing changes until someone clicks, and each browser remembers the choice. The panel stays mounted, so unsaved slug, byline and plugin panel values survive a hide and show. A new useSettingsPanel hook owns this state, which keeps the hunks in ContentEditor.tsx small.
  • Anything that needs the panel opens it. An image or gallery settings panel shows the panel until it closes. If Save is blocked by an invalid control in the hidden panel, such as a plugin's number field, the panel opens and the browser focuses that control and shows its message. While a version is shown, the bar shows the version stepper instead of the hidden list.
  • Distraction-free mode is removed. This removes its bar button, the ⌘⇧\ shortcut, the full-screen overlay, and the props that only it used.

Scope

  • Below 1024px the panel is still the Settings sheet. The only change there is that the distraction-free button is gone, so the phone bar is one row shorter.
  • Inline comments, presence avatars and the single-bar app shell are later PRs.

Tradeoffs

  • Hiding the panel while an image or gallery panel is open closes that panel and discards unapplied image edits, as Escape or deselecting the image already does. Keeping it open behind the hidden panel let Escape, ⌘S and the toolbar's Image settings button act on it unseen.
  • Kumo's drag-to-collapse stays off, so the resize handle works as it does today.

Blast radius

This changes admin layout only. It changes no API, schema, config or plugin contract. Writers who used distraction-free mode lose it. On desktop the toggle covers its full-width use. The visual regression baselines for the editor screens change because the bar changed, so they need a maintainer /accept-baselines.

Type of change

  • Bug fix
  • Feature (requires an accepted feature plan or RFC)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Your connection to this change

  • I use EmDash and ran into the problem this PR addresses
  • I maintain a tool, dependency, or service that EmDash uses, and this change concerns that integration
  • A Maintainer approved this specific change before I opened the PR

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to their merged design PR: https://github.com/emdash-cms/emdash/pull/...
  • I have included screenshots below if this PR changes the UI

AI assistance disclosure

  • This PR includes AI-generated code or text — model/tool: Claude Opus 5.5

Screenshots / test output

The bar ends with the new toggle instead of the distraction-free button. In Arabic the panel and the toggle sit on the left.

Before After
Editor bar before the change, ending with the distraction-free button Editor bar after the change, ending with the Hide settings button

Hiding the panel gives the page the full width.

Before (panel always open) After (panel hidden)
Editor before the change, with the settings panel open and the page squeezed beside it Editor after hiding the settings panel, with the page centered in the full width
Arabic
Before After
Arabic editor bar before the change, starting with the distraction-free button Arabic editor bar after the change, starting with the Hide settings button next to the panel
Before (panel always open) After (panel hidden)
Arabic editor before the change, with the settings panel open on the left and the page beside it Arabic editor after hiding the settings panel, with the page centered in the full width

Verification:

  • A new Playwright spec, editor-settings-panel.spec.ts, covers hide, reload and show, measures the page centering and the hidden panel's width to 1px, and checks that a typed slug survives. It also covers Arabic, image settings opening a hidden panel, and the version stepper. With the content actions, revisions, image panel, autosave and plugin editor extension specs, 31 tests pass in Chromium.
  • The full admin Vitest suite passes (313 files). New unit tests cover the invalid-control reveal on Save, with and without reduced motion, and reopening a hidden panel on a read-only entry. Each one fails when the behavior it protects is removed.
  • In the real admin at 1280, 1024, 1023 and 375px, in light and dark mode and in Arabic, the bar stays 48px, no other control moves when the panel hides, and no line is left at the screen edge.

Writers who want the page alone had only distraction-free mode, which
also hides the editor bar. The toggle keeps the bar and slides the panel
away without unmounting it, so unsaved panel values survive. An open
image or gallery panel shows the panel until it closes, and an invalid
panel control on Save reveals it, without overwriting the remembered
choice. Hiding closes an open image or gallery panel, as Escape does.
Layout only shows up with real CSS: the zero-width clip, page centering,
the Arabic placement, and the reveals for image settings and versions.
The settings panel toggle now hides the panel so the page can take the
full width, which covers what distraction-free mode was for, and the
editor bar had too many controls. Remove the bar button, the mod+shift+\
shortcut, the full-screen overlay, the bar's extra publishing fallbacks,
and the props that only that mode used.
@changeset-bot

changeset-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 82d720b

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

This PR includes changesets to release 12 packages
Name Type
@emdash-cms/admin Minor
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
create-emdash Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
@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

@pkg-pr-new

pkg-pr-new Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@4779

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@4779

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@4779

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@4779

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@4779

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@4779

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@4779

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@4779

upgrade-emdash

npm i https://pkg.pr.new/upgrade-emdash@4779

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@4779

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-ai-search

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-search@4779

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@4779

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: 82d720b

@emdashbot emdashbot Bot 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.

The approach is sound. A collapsible settings panel fixes the cramped desktop editor, the hook fits the existing sidebar architecture, and removing distraction-free mode matches the maintainer-approved scope in the PR description. Both reviewers approved and found no blocking issues. Reviewer notes covered persistence and breakpoint handling, the panel staying mounted, inert on the collapsed panel, deferred validation reporting when Save is blocked by a hidden invalid control, revision navigation, RTL, localization, and removal of the old props and hotkey. One non-blocking suggestion is to improve the changeset text and add the new toggle to the user guide. Two gaps remain. The Feature box is checked but no merged design PR is linked, so a maintainer should confirm the description's approval is enough. One reviewer could not confirm that Kumo's Sidebar accepts contentClassName and inert, or that it calls onOpenChangeComplete on controlled changes. The review was static and no tests or builds were run.


Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.

github-actions Bot pushed a commit that referenced this pull request Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Visual regression: 4 screens changed

These admin screens render differently on this PR. Confirm every change below is intended before accepting.

Screen Image Compare
content-editor-ltr expected · actual
content-editor-rtl expected · actual
content-new-ltr expected · actual
content-new-rtl expected · actual

Maintainers: if every change above is intended, comment /accept-baselines
to commit the regenerated Linux baselines to this PR.

Measured head: 82d720b1353e9c4f65da6330ba0cc65806b182cf. /accept-baselines accepts the snapshots for this commit.

The content guide only described the version stepper on phones and
never said the settings panel can be hidden. The toggle changeset now
names the button and the cases that open a hidden panel.
@emdashbot emdashbot Bot added the review/needs-review No maintainer or bot review yet label Nov 9, 2026
@khoinguyenpham04

Copy link
Copy Markdown
Collaborator Author

/accept-baselines

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

The Visual Regression run for the current head (82d720b) is still in progress. Wait for it to finish, then comment /accept-baselines again.

github-actions Bot pushed a commit that referenced this pull request Nov 9, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://noah-editor-panel-toggle-2fa587.try.emdashcms.com, https://noah-editor-panel-toggle-2fa587-emdash-playground.emdash-cms.workers.dev (commit 82d720b)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://0ef9d2b2.try.emdashcms.com, https://0ef9d2b2-emdash-playground.emdash-cms.workers.dev 82d720b 2026-11-09T16:23:52.140Z Visit the dashboard ↗

@emdashbot emdashbot Bot 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.

The approach remains sound, and this documentation-only follow-up addresses the earlier suggestion. The changeset now names Hide settings / Show settings and explains automatic panel opening and revision navigation. The user guide covers the same behavior.

I reviewed both changed files against the documentation conventions and relevant editor implementation. No new defects or outstanding findings in this follow-up. Review was static; no tests or builds were run.


Follow-up review by openai/gpt-6.1-sol, scoped to the changes since the last review.

@cloudflare-workers-and-pages

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 82d720b Nov 09 2026, 04:23 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/needs-review No maintainer or bot review yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant