Skip to content

id(web): image resize west handles (nw/sw) drag in the wrong direction — outward shrinks, inward grows #1389

Closed

Description

@dezren39

Summary

Resizing an image by its left-hand (west) corner handles moves the width in the
wrong direction: pulling the left edge outward (left) shrinks the image, and
pushing it inward (right) grows it. The east handles (ne/se) behave
correctly. The persisted width/height attrs on mouse-up inherit the inverted
size, so the wrong size is also what gets saved.

Evidence (verified on main 95bfedb, this run)

pkgs/id/web/src/image-node-view.ts:

  • :164 — private startResize(e: MouseEvent, _corner: string) — the corner
    argument is received and deliberately discarded (_corner).
  • :180-185 — onResizeMove always computes
    newWidth = Math.max(50, this.startWidth + dx) regardless of which handle
    started the drag.
  • Handles nw/sw are positioned on the left edge
    (pkgs/id/web/src/editor-compat.css:1301-1320, left: -5px,
    cursor: nw-resize / sw-resize), so for them a leftward drag (negative
    dx) is the outward/widening motion — the formula treats it as shrinking.

Probe (targeted vitest, real ImageNodeView + real EditorView/richSchema,
happy-dom; start width falls back to 200px; probe removed after the run, log in
the creator's probe archive):

  • se handle, drag right +50px → width 250px (correct control)
  • nw handle, drag left −50px (outward) → width 150px (expected 250px)
  • nw handle, drag right +50px (inward) → width 250px (expected 150px)
  • sw handle, drag left −50px (outward) → width 150px (expected 250px)

ImageNodeView has no test file today (pkgs/id/web/src/image-node-view.ts
is the only editor component of its size without one), which is how this
shipped unnoticed.

Why it matters

Half of the four resize handles do the opposite of what the user drags. Image
sizing is a core rich-editing gesture; users grabbing the natural left edge
get a fighting-the-mouse experience and can persist a wrong size on mouse-up
(onResizeEnd commits offsetWidth/offsetHeight via updateAttrs).

Acceptance criteria

  • Dragging nw/sw handles outward widens the image and inward shrinks it;
    ne/se behaviour unchanged; aspect ratio still maintained.
  • The direction is derived from the corner passed to startResize
    (west corners invert the sign of dx); the min-width (50px) and
    editor max-width clamps still apply after the sign fix.
  • New image-node-view.test.ts (or equivalent) covers all four corners'
    drag directions with a real EditorView, including the committed
    width/height attrs on mouse-up.
  • Web unit tests + typecheck pass.

Notes

Fix is small and self-contained in image-node-view.ts. Siblings in the same
component family, distinct defects: #1381 (image browser teardown), #1379 /
#1323 / #1321 (image upload handlers).

Activity

  1. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  2. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/creatorFiled by the new-issue-creator job
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    priority/normalOrdinary priority (the default)
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 27, 2026
  3. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    state: filed
    agent: new-issue-creator-code-b
    Found via: filed this run — targeted vitest probe (real ImageNodeView + EditorView/richSchema, happy-dom) on main 95bfedb: se control drag +50px → 250px (correct); nw outward −50px → 150px, nw inward +50px → 250px, sw outward −50px → 150px (all inverted). Root cause: startResize discards the corner (image-node-view.ts:164, _corner) and onResizeMove always uses startWidth + dx (:185). Probe removed after the run; log: hidden_files/probe-2026-10-27-creator-b3/out.log. Enqueued as a small_fix packet to repo-health-code-pilot.

  4. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    state: filed
    agent: new-issue-creator-code-b
    Found via: filed this run — targeted vitest probe (real ImageNodeView + EditorView/richSchema, happy-dom) on main 95bfedb: se control drag +50px → 250px (correct); nw outward −50px → 150px, nw inward +50px → 250px, sw outward −50px → 150px (all inverted). Root cause: startResize discards the corner (image-node-view.ts:164, _corner) and onResizeMove always uses startWidth + dx (:185). Probe removed after the run; log: hidden_files/probe-2026-10-27-creator-b3/out.log. Enqueued as a small_fix packet to repo-health-code-pilot.

  5. added
    work/assignedQueue worker lifecycle state
    and removed on Oct 28, 2026
  6. 49 remaining items

  7. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    {"schema":"agent-note:v1","event":"parked","task_id":1362,"worker":"repo-worker-code","lane":"A","note":"Re-parked 20m: PR #1592 visible checks pass; the guard aggregate remains queued behind the stalled flake sub-jobs (#1599). Resume merges on green and completes fixed_merged."}

  8. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 28, 2026
  10. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  11. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions