Repository navigation
fix(admin): widen custom block editor modal - #3108
Conversation
🦋 Changeset detectedLatest commit: a52abd0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 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 |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@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-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.tsxand its only call-site (PluginBlockModal). - Both new browser tests and the existing save-without-submit test.
vitest.config.ts(browser mode, viewport 1280×800) andtests/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-35The Tailwind CLI invocation is now duplicated between the
buildandtestscripts. 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:stylesscript 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:styleskeeps the command pnpm-friendly and avoids re-invoking the shell withnpm run/pnpm run, which can behave differently across package managers.
There was a problem hiding this comment.
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.
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-widen-portable-text-block-dialog.try.emdashcms.com, https://fix-widen-portable-text-block-dialog-emdash-playground.emdash-cms.workers.dev (commit a52abd0)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
What does this PR do?
Widens field-backed Portable Text custom block dialogs from Kumo's 512px
lgsize to its 768pxxlsize. This gives multi-field block forms enough horizontal space while keeping simple URL-only embed dialogs at the compactsmsize.No linked issue.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
Before — field-backed custom block dialog at 512px:
After — the same custom block dialog at 768px:
Verified with:
pnpm --filter @emdash-cms/admin test tests/editor/plugin-block-modal.test.tsx(1 passed)pnpm buildpnpm typecheckpnpm lint