Repository navigation
fix(admin): keep confirm dialog buttons in place while pending - #5258
khoinguyenpham04 wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: d5a9ec9 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-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
upgrade-emdash
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-ai-search
@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: |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | d5a9ec9 | Dec 04 2026, 08:10 PM |
There was a problem hiding this comment.
The approach is sound. Stacking both the normal and pending labels in one grid cell reserves space for the wider label, so the shared ConfirmDialog button no longer resizes when it enters the pending state. This needs no hard-coded width. The inactive label is hidden from assistive technology, so the visible label stays the accessible name. The new regression test measures real button positions and widths at phone and desktop viewports, and the updated ContentEditor locator is more robust. Both reviewers approved, and neither ran the tests. One non-blocking suggestion remains: the new test resets the viewport only on its last line, so an earlier failure would leave later tests at the narrow width.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
There was a problem hiding this comment.
The follow-up is the right change: wrapping the regression test in try/finally restores the viewport even when rendering or an assertion fails, without changing what the test verifies.
The earlier viewport-cleanup suggestion is addressed. I reviewed the follow-up diff and surrounding test code; no new issues remain. Review was static; I did not run tests or other tooling.
Follow-up review by openai/gpt-6.1-sol, scoped to the changes since the last review.
7e83eb1 to
0e3905f
Compare
There was a problem hiding this comment.
The approach remains appropriate: reserving space for both confirmation labels prevents pending-state layout shifts, while truncation accommodates narrow dialogs and hidden labels stay out of the accessible name.
I reviewed the follow-up diff and surrounding implementation and tests. The earlier viewport-cleanup suggestion remains addressed with try/finally, including the narrow-dialog regression test. No new issues to fix were found in this PR.
Review was static; I did not run tests, builds, or other checks.
Follow-up review by openai/gpt-6.1-sol, scoped to the changes since the last review.
0e3905f to
a0707fe
Compare
There was a problem hiding this comment.
The approach remains appropriate: reserving space for both labels prevents pending-state button movement while preserving the visible label as the accessible name.
I reviewed the supplied follow-up diff and relevant surrounding code and tests. The earlier viewport-cleanup suggestion remains addressed with try/finally, including in the narrow-dialog regression test. No new issues to fix were found.
Review was static; I did not run tests, builds, or other checks.
Follow-up review by openai/gpt-6.1-sol, scoped to the changes since the last review.
|
Cloudflare builds and deploys previews for this pull request. Learn more about Cloudflare previews.
Updated: |
a0707fe to
cdd0327
Compare
There was a problem hiding this comment.
The approach remains appropriate: reserving space for both confirmation labels prevents pending-state button movement while keeping the visible label as the accessible name.
I compared the supplied follow-up with the current PR diff and checked the dialog implementation, layout regression tests, role-based delete-confirmation locator, and changeset. The earlier viewport-cleanup suggestion remains addressed with try/finally in both layout tests. No new issues to fix were found in the PR-specific changes.
Review was static; I did not run tests, builds, or other checks.
Follow-up review by openai/gpt-6.1-sol, scoped to the changes since the last review.
The confirm button swapped its label for the pending text, so it resized under the pointer. Both labels now share one grid cell, the inactive one hidden and aria-hidden, so the button keeps the wider label's width and its name stays the visible label. The editor's delete test now finds the confirm button by role rather than by its text content, which includes the hidden label.
The pending-width test resized the viewport and only restored it on its last line, so a failed assertion left later tests in the file at the phone width.
The confirm button reserved the width of its longer label but kept the button's own w-max shrink-0, so a long translated pending label, such as Italian's for Discarding..., pushed it past a phone dialog's edge even before confirming. The button can now shrink to the footer, and its labels end in an ellipsis when they don't fit.
The label grid's track now has a zero minimum, so the button's min-content width doesn't depend on how an engine sizes a truncated grid item. The test now checks that the visible label sits inside the button and that a long pending label ends in an ellipsis.
cdd0327 to
d5a9ec9
Compare
What does this PR do?
Stops the confirm button in confirmation dialogs from resizing when you confirm. It swapped its label for the pending text, such as "Moving to trash...", so it resized under the pointer: the trash confirmation's button grew 24 px wider.
Both labels now share one grid cell in every
ConfirmDialog. The inactive one is invisible andaria-hidden, so the button keeps the width of the longer label and its accessible name stays the visible label. The idle button is now as wide as its longer label. The button can shrink to fit the dialog, and a label too long for it, such as Italian's 40-character pending text for Discarding..., ends in an ellipsis instead of running past the dialog's edge.ContentEditor.test.tsxnow finds the delete confirmation's button by role. Its old locator matched on text content, which now includes the hidden pending label.Type of change
Your connection to this change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain. Not applicable: no new strings.AI assistance disclosure
Screenshots / test output
Measured on the
demos/simpleproduction build, served gzipped, with the cache disabled and Slow 4G throttling, at 390 px with a 4× CPU slowdown and at 1440 px. The Slow 4G recordings attached at the end show the old build on the left and this one on the right.Move to Trash confirmation on a 390 px phone, before confirming on the left of each image and while the request runs on the right
Regression test that fails on
mainand passes here:ConfirmDialog.test.tsx: "keeps both buttons in place on %s while its request runs", at 390 px and 1280 px.ConfirmDialog.test.tsx: "keeps a long pending label inside a small phone's dialog", at 320 px. It checks that the visible label stays inside the button in both states and that the pending label ends in an ellipsis.On the top of the stack,
pnpm build,pnpm typecheck,pnpm lint:quick(0 diagnostics),pnpm formatand the full admin suite (369 files, 5,822 tests) pass.trash-confirm-phone-slow-4g.mp4