fix(admin): make image actions reliably selectable - #2490
fix(admin): make image actions reliably selectable#2490khoinguyenpham04 wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 2557aad The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 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 |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
View logs |
emdash-demo-do | 2557aad | Aug 16 2026, 01:45 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 2557aad | Aug 16 2026, 01:48 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 2557aad | Aug 16 2026, 01:49 PM |
There was a problem hiding this comment.
This PR targets the right problem with a focused, idiomatic fix. Moving image selection from the unreliable click event to pointerdown means small pointer drift no longer prevents the image from being selected, and removing the hover-only opacity keeps the actions visible while the image is selected. The approach fits EmDash's TipTap/React node view architecture and is consistent with how the editor handles block selection.
What I checked:
- Read the diff and the full
ImageNode.tsx, plus the new regression test. - Compared with sibling node views (
GalleryNode,HtmlBlockNode,PluginBlockNode,CodeBlockNode) to confirm this is an image-specific fix rather than a systemic pattern change. - Verified the changeset follows the release-note style and that all UI strings remain Lingui-wrapped and Tailwind logical-class usage is RTL-safe.
- Confirmed the admin package runs browser tests via
vitest-browser-react+ Playwright, so thegetComputedStyleassertion in the regression test runs against a real Chromium DOM.
The guard in handlePointerDown (editor.isEditable, event.isPrimary, event.button !== 0, typeof getPos() === "number") is correct, and setNodeSelection(getPos()) is the right ProseMirror API for selecting a block node. The test reproduces the exact failure mode (six pixels of pointer drift) and asserts the observable outcome (settings button becomes visible). No AGENTS.md convention violations. LGTM.
@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-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@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: |
What does this PR do?
Fixes image action controls intermittently failing to appear in the Portable Text editor. Images now become selected on the primary pointer-down event, so slight pointer movement before release does not lose the selection, and the actions remain visible while the image is selected.
Closes #2478
Type of 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.AI-generated code disclosure
Screenshots / test output
packages/admin: 120 test files and 1,423 tests passed.