Skip to content

fix(admin): widen custom block editor modal - #3108

Merged
ascorbic merged 4 commits into
mainfrom
fix/widen-portable-text-block-dialog
Sep 14, 2026
Merged

ascorbic merged 4 commits into
mainfrom
fix/widen-portable-text-block-dialog

Conversation

@ascorbic

@ascorbic ascorbic commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Widens field-backed Portable Text custom block dialogs from Kumo's 512px lg size to its 768px xl size. This gives multi-field block forms enough horizontal space while keeping simple URL-only embed dialogs at the compact sm size.

No linked issue.

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). Not applicable; the dialog width is verified with rendered before-and-after screenshots.
  • User-visible strings in the admin UI are wrapped for translation (if applicable). No user-visible strings changed.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to an approved Discussion: Not applicable; this is a bug fix.
  • I have included screenshots below if this PR changes the UI

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Codex (GPT-5)

Screenshots / test output

Before — field-backed custom block dialog at 512px:

The Home page Hero custom block editor before the change, constrained to a narrow 512-pixel dialog

After — the same custom block dialog at 768px:

The Home page Hero custom block editor after the change, using a wider 768-pixel dialog

Verified with:

  • pnpm --filter @emdash-cms/admin test tests/editor/plugin-block-modal.test.tsx (1 passed)
  • pnpm build
  • pnpm typecheck
  • pnpm lint
  • Arabic RTL browser pass at 768px

@changeset-bot

changeset-bot Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a52abd0

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 Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 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

@github-actions github-actions Bot added area/admin size/S review/needs-review No maintainer or bot review yet labels Sep 14, 2026
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Sep 14, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

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

@emdash-cms/plugin-test

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

@emdash-cms/plugin-types

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

@emdash-cms/registry-client

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

@emdash-cms/registry-lexicons

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

@emdash-cms/registry-moderation

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

@emdash-cms/registry-verification

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

@emdash-cms/sandbox-workerd

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: a52abd0

@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 small, focused fix that addresses the right problem: field-backed Portable Text custom block dialogs were too narrow. The approach is sound—collapse the previous complexity-based sizing into a simple hasFields ? "xl" : "sm" rule so the same modal component handles compact URL-only embeds and wider Block Kit forms. This matches the PR description and keeps URL embeds at the small size.

I checked the changed component, the new browser regression test, and the changeset against .changeset/README.md. The test runs under the Playwright browser config, so the 700 px bounding-box assertion actually exercises layout. The changeset is accurate and proportional for a patch. No blocking logic bugs, security issues, or AGENTS.md regressions were introduced.

The only gap is that the PR also states it wants URL-only dialogs to stay compact, but the new test only covers the widened field-backed path. A companion test for field-less blocks would protect the sm behavior from accidental widening.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Sep 14, 2026
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-review No maintainer or bot review yet labels Sep 14, 2026
@github-actions github-actions Bot added review/needs-rereview New commits since the last review size/M cla: signed and removed size/S review/awaiting-author Reviewed; waiting on the author to respond labels Sep 14, 2026
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Sep 14, 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.

The approach is still right: collapse the field-complexity sizing into a simple hasFields ? "xl" : "sm" rule, widening all field-backed Portable Text custom block dialogs while keeping URL-only embed dialogs compact. The new URL-only test correctly fills the gap I flagged in the previous review, and the changeset is accurate and useful.

I re-checked the component change, both new browser-mode tests, the changeset against .changeset/README.md, and the test infrastructure. The only new issue is that the tests now import packages/admin/dist/styles.css, a built artifact that does not exist in a clean checkout and is covered by .gitignore. Because packages/admin/package.json runs tests with plain vitest and has no pre-build step, a fresh pnpm test will fail with a module-not-found error before any assertion runs. This undermines the bug-fix test coverage the PR adds.

Fix the test to load a source-controlled stylesheet (e.g. ../../src/styles.css) and configure the browser harness to compile it, or add an explicit pre-test build step. Once that import is resolved the rest looks good to merge.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Sep 14, 2026
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Sep 14, 2026
@github-actions github-actions Bot added review/needs-rereview New commits since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Sep 14, 2026
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Sep 14, 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.

Re-review of #3108.

The approach remains correct: collapsing the field-complexity sizing into a simple hasFields ? "xl" : "sm" rule is the right fix for cramped custom-block forms, and it keeps URL-only embed dialogs compact. The component change is minimal and localized to PluginBlockModal.

Previously open issue is fixed. The new browser tests still import packages/admin/dist/styles.css, but package.json now runs a pre-test Tailwind build (npx @tailwindcss/cli -i src/styles.css -o dist/styles.css --minify) before vitest, so a clean pnpm test no longer fails with a module-not-found error before any assertion runs. pnpm test, pnpm test:browser, and CI’s recursive package-test path all build the stylesheet first.

What else I checked:

  • Component change in PortableTextEditor.tsx and its only call-site (PluginBlockModal).
  • Both new browser tests and the existing save-without-submit test.
  • vitest.config.ts (browser mode, viewport 1280×800) and tests/setup.ts.
  • The changeset against .changeset/README.md — it leads with the user-facing fix, names the affected surface, and is proportional to a patch.
  • CONTRIBUTING.md — no new user-visible strings, so no Lingui changes needed; no screenshots were required beyond what the PR already includes.

Remaining concern: the Tailwind CLI invocation is duplicated verbatim between build and test. That’s a maintainability risk: if the output path or flags change for publishing, the test script will silently build stale/incorrect CSS. Extract a shared build:styles script and reference it from both.

Once that duplication is addressed this is good to merge.


Findings

  • [suggestion] packages/admin/package.json:30-35

    The Tailwind CLI invocation is now duplicated between the build and test scripts. If the stylesheet output path or flags ever change for publishing, the test script can build stale or incorrect CSS and the width assertions may fail in confusing ways.

    Extract a shared build:styles script and reference it from both places so the build command is a single source of truth.

        "build:styles": "npx @tailwindcss/cli -i src/styles.css -o dist/styles.css --minify",
        "build": "node --run locale:compile && tsdown && node --run locale:copy && node --run build:styles",
        "dev": "tsdown --watch",
        "prepublishOnly": "node --run build",
        "check": "publint && attw --pack --ignore-rules=cjs-resolves-to-esm --ignore-rules=no-resolution",
        "test": "node --run build:styles && vitest",
    

    node --run build:styles keeps the command pnpm-friendly and avoids re-invoking the shell with npm run/pnpm run, which can behave differently across package managers.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Sep 14, 2026
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-rereview New commits since the last review labels Sep 14, 2026
@github-actions github-actions Bot added review/needs-rereview New commits since the last review size/S and removed size/M review/awaiting-author Reviewed; waiting on the author to respond labels Sep 14, 2026
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Sep 14, 2026
@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Sep 14, 2026
@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Sep 14, 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.

Re-review of #3108 — the previously reported build-script duplication is resolved, and the component change remains correct.

What changed since the last review. The package.json changes that duplicated the Tailwind CLI invocation between build and test are gone (pnpm test is simply "vitest" again). Resolving that also removed the browser tests that imported packages/admin/dist/styles.css, so there is no longer a risk of a pre-test stylesheet mismatch. The only surviving test in tests/editor/plugin-block-modal.test.tsx exercises save-without-submit behavior and does not need built CSS.

The actual fix. Collapsing the field-complexity sizing into const dialogSize = hasFields ? "xl" : "sm" is still the right approach for the problem shown in the screenshots: multi-field custom-block forms are cramped at the old 512 px lg width, and URL-only embed dialogs stay compact at the existing sm size. It is localized to PluginBlockModal and does not touch data models, routes, or auth.

Checks.

  • Localization: no new user-visible strings.
  • RTL/Tailwind: existing dialog markup already uses logical utilities (end-4, etc.) in the changed area.
  • Changeset against .changeset/README.md: a clear, present-tense, user-facing patch entry that identifies the affected surface and the observable problem.
  • No AGENTS.md SQL/API/authorization/index concerns are touched by this admin-only UI change.
  • Type-aware lint/typecheck results are unverified from static review, but the diff is simple enough that there is nothing to contradict the author’s claim that both pass.

One non-blocking note. The width change is verified by before-and-after screenshots rather than an automated test. The author explicitly called this out as screenshot-verified, which is reasonable for a single-layout tweak, though a visual-regression baseline would be the stronger long-term guard if EmDash wants every UI change under the EMDASH_VISUAL gate. That is not a blocker here.

Good to merge.

@emdashbot emdashbot Bot removed the bot:review Trigger an emdashbot code review on this PR label Sep 14, 2026
@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-rereview New commits since the last review labels Sep 14, 2026
@ascorbic
ascorbic enabled auto-merge (squash) September 14, 2026 16:21
@cloudflare-workers-and-pages

Copy link
Copy Markdown

@ascorbic
ascorbic merged commit 0a723e9 into main Sep 14, 2026
63 checks passed
@ascorbic
ascorbic deleted the fix/widen-portable-text-block-dialog branch September 14, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant