Skip to content

Rework SortableGrid dragging, and make framed list content flush - #122

Open
andrewhuhh wants to merge 3 commits into
mainfrom
andrew/sortable-grid-rework
Open

andrewhuhh wants to merge 3 commits into
mainfrom
andrew/sortable-grid-rework

Conversation

@andrewhuhh

@andrewhuhh andrewhuhh commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Reworks SortableGrid's pointer drag so a card follows the pointer and the grid only reshuffles when the drop target actually changes. Also makes list content flush inside two framed-card examples.

SortableGrid drag

  • At pick-up the grid snapshots every slot's rect relative to the list. Hit-testing uses those rects for the whole drag, so a reflow mid-drag can't move the target under the pointer.
  • The target is the slot whose centre is nearest the held card's centre (computed from the pointer and the grab offset). A new target has to be closer than the current one by 25% of the slot's shorter side, so a pointer resting on a boundary no longer flips back and forth.
  • The held card follows the pointer (motion values, layout animation off while held). The other cards animate to their new positions only when the target changes. A dashed placeholder marks where the card will land.
  • On release the card springs into its slot (spring.moderate), or snaps under reduced motion. Keyboard reordering is unchanged.

Reorder count

Measured with a Playwright spec: a slow 160-step drag of the "Secrets Management" handle to the third card plus a small jiggle, counting changes to the DOM order of the cards over the whole drag.

Run 1 Run 2 Run 3
Before 56 60 50
After 2 2

The final order is the same on every run. A separate check with reduced motion and the keyboard (Space, ArrowRight, ArrowDown, Space) moves the card to the end and keeps focus on its handle.

Re-check on main after v0.1.14

Repeated on 198ba3d (main after the release, merged in) with the same slow drag to the third slot. Each run reorders twice, lands on the same final order, and the held card sits exactly under the pointer while dragging (0px offset).

Light Dark
Desktop, mid-drag
390px, mid-drag

Recordings

Before:

https://api.capy.ai/pr-assets/v_PPrUQCBiL0u6RWgUNgMKluKxBY5hVQ39BSV6q5DJTuY.mp4

After:

https://api.capy.ai/pr-assets/v_oxBva_hYBuzxou3dPpauE12YuKymbHK8SrSCg5F5quQ.mp4

Mid-drag, with the placeholder:

Mid-drag

The sortable-grid-default baselines don't change: the resting state is identical.

Flush content in framed cards

Framed card content was padded with Inset around a single borderless child, which left a gap between the card edge and the rows. sortable-list/card ("Evaluation order") and empty-state/ghost ("App connections") now use flush. An audit of every showcase example and every Cipher component found no other cases.

These are the 8 baseline changes:

Light Dark
sortable-list-card, desktop
sortable-list-card, 390px
empty-state-ghost, desktop
empty-state-ghost, 390px

Open in Capy

…ent flush in framed cards

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cipher-122-rework-sortablegrid-dragging-and-make-framed-list-content-f

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The reviewed changes appear safe to merge after the release timing stated in the PR.

Summary

Reworks SortableGrid dragging so cards follow the pointer while fixed targets reduce reshuffling, and makes two framed-card examples edge-to-edge.

  • SortableGrid cards follow the pointer and settle into steadier slots.
  • The “Evaluation order” and “App connections” examples fill their framed cards.

No new actionable issues found.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Comment thread src/ui/sortable-grid.tsx Resolved
andrewhuhh and others added 2 commits November 17, 2026 22:30
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai capy-ai Bot added the live-preview label Nov 17, 2026

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant