Skip to content

fix(admin): keep rich-text formatting toolbar visible on long posts - #1223

Merged
ascorbic merged 2 commits into
mainfrom
fix/1192-sticky-editor-toolbar
Jun 2, 2026
Merged

fix(admin): keep rich-text formatting toolbar visible on long posts#1223
ascorbic merged 2 commits into
mainfrom
fix/1192-sticky-editor-toolbar

Conversation

@scottbuscemi

@scottbuscemi scottbuscemi commented May 29, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Closes #1192.

When editing long posts, the WYSIWYG formatting toolbar scrolled out of the viewport, forcing users to scroll back up to apply formatting.

Fix:

  • Make the EditorToolbar root sticky with an opaque bg-kumo-tint so content doesn't bleed through.
  • Switch the editor wrapper from overflow-hidden to overflow-clipoverflow-hidden established a nested scroll container that broke sticky positioning; overflow-clip still clips the rounded corners without doing so.
  • The scroll container is the admin shell <main>, which carries p-6 padding; the toolbar uses -top-6 so it pins flush to the top of the scroll area (cancelling that padding) rather than leaving a gap where scrolled content shows through.
  • Minimal/distraction-free editors (e.g. Widgets) don't render the toolbar and are unaffected.

Testing: pnpm lint:quick clean, @emdash-cms/admin typecheck passes. CSS-only change, verified in-browser (LTR, RTL/Arabic, and unscrolled) — toolbar pins flush with no gap, rounded corners intact, bubble/slash menus still layer above it.

Manual verification:

  1. Edit a post and paste lots of content into the Content field.
  2. Scroll down. Expect the formatting toolbar to stay pinned at the top of the editing area, opaque, buttons clickable, with no gap above it.
  3. Confirm bubble/slash menus still appear above it; verify in an RTL locale (Arabic).

Type of change

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

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 a changeset (if this PR changes a published package)
  • New features link to an approved Discussion

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.8 (Claude Code, review-fix commits)

Screenshots / test output

Before (gap above toolbar) → after (flush) verified in-browser; see review thread.


Try this PR

Open a fresh playground →

A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.

Tracks fix/1192-sticky-editor-toolbar. Updated automatically when the playground redeploys.

The editor toolbar scrolled out of view on long documents. Make it
`sticky top-0` and switch the editor wrapper from `overflow-hidden` to
`overflow-clip` so the rounded corners still clip without establishing a
nested scroll container that breaks sticky positioning. The scroll
container is the admin shell <main>, so top-0 pins it under the header.
Closes #1192.
@changeset-bot

changeset-bot Bot commented May 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3df4b75

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

This PR includes changesets to release 14 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd 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 29, 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 59072e5 Jun 02 2026, 08:33 AM
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 29, 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 59072e5 Jun 02 2026, 08:33 AM
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 29, 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 59072e5 Jun 02 2026, 08:32 AM
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label May 31, 2026

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

This is a clean, minimal CSS fix that correctly addresses the stated problem.

Approach: Using position: sticky on the toolbar and switching the wrapper from overflow-hidden to overflow-clip is the right solution. overflow-hidden establishes a scroll container that traps sticky positioning, while overflow-clip clips the rounded corners without creating that trap, letting the toolbar stick to the admin shell <main> scroll container. The z-10 on the toolbar is safely below the z-[100] used by bubble menus, slash menus, and table menus. Making the background fully opaque (bg-kumo-tint) instead of 50% opacity prevents content from bleeding through when the toolbar is stuck — a necessary visual change.

What I checked:

  • Diff scope: Two-line CSS-only change plus a changeset. No drive-by edits.
  • AGENTS.md conventions: No new user-facing strings (nothing to localize via Lingui). No physical directional Tailwind classes added — top-0 and z-10 are direction-neutral. The existing border-b is unchanged and not a new regression.
  • Sticky/clipping interaction: overflow-clip does not establish a scroll container, so the toolbar’s sticky positioning correctly uses the <main> overflow-y-auto ancestor. The wrapper is tall (contains the full editor content), so the toolbar remains within the wrapper’s clip box for the entire scroll range and won’t be prematurely clipped.
  • Z-index hierarchy: Floating menus (bubble, slash, table) all use z-[100], well above the toolbar’s z-10.
  • Changeset: Present, correctly scoped to @emdash-cms/admin as a patch, with a descriptive message.
  • Tests: No existing tests reference the changed CSS classes, so there’s no test breakage risk. A purely visual CSS fix is appropriately left to manual verification.

No issues found. LGTM.

@ascorbic

Copy link
Copy Markdown
Collaborator
image

Good fix! Just one change: there's a gap between the the toolbar and the top of the window. See the screenshot and preview: https://fix-1192-sticky-editor-toolbar-emdash-playground.emdash-cms.workers.dev/_emdash/admin/content/posts/01KSYFK0XDSY4HX1J86X3J012G

The sticky toolbar pinned against the scroll container's padding box,
sticking 24px (the admin <main> p-6 top padding) below the viewport top
and leaving a band where scrolled content showed through above the bar.
Offset the sticky top by the padding so it pins flush.
@pkg-pr-new

pkg-pr-new Bot commented Jun 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

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

@emdash-cms/plugin-types

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

@emdash-cms/registry-client

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

@emdash-cms/registry-lexicons

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

@emdash-cms/sandbox-workerd

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: 59072e5

@ascorbic
ascorbic marked this pull request as ready for review June 2, 2026 08:58
Copilot AI review requested due to automatic review settings June 2, 2026 08:58
@github-actions github-actions Bot added the review/needs-rereview Author pushed changes since the last review label Jun 2, 2026

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

Fixes the admin rich-text editor toolbar scrolling out of view on long posts by making the toolbar sticky and adjusting the editor container’s overflow behavior so sticky positioning can work while preserving rounded-corner clipping.

Changes:

  • Switch the editor wrapper from overflow-hidden to overflow-clip to avoid interfering with position: sticky while still clipping rounded corners.
  • Make the EditorToolbar sticky (with -top-6, z-10) and use an opaque background to prevent content bleed-through.
  • Add a patch changeset for @emdash-cms/admin documenting the UI fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/admin/src/components/PortableTextEditor.tsx Updates editor container overflow and makes the formatting toolbar sticky/opaque to remain visible during scroll.
.changeset/fix-sticky-editor-toolbar.md Adds a patch changeset describing the sticky toolbar behavior change.

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

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tested in the playground. Looks great!

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-rereview Author pushed changes since the last review labels Jun 2, 2026
@ascorbic
ascorbic merged commit 34afc14 into main Jun 2, 2026
41 of 42 checks passed
@ascorbic
ascorbic deleted the fix/1192-sticky-editor-toolbar branch June 2, 2026 09:08
@emdashbot emdashbot Bot mentioned this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin bot:review Trigger an emdashbot code review on this PR cla: signed review/approved Approved; no new commits since size/XS

3 participants