Skip to content

feat(Icon, List): a drag icon; the reorder handle draws it through ComponentIcon - #12195

Closed
cixzhang wants to merge 5 commits into
mainfrom
lane2/drag-icon-handle
Closed

cixzhang wants to merge 5 commits into
mainfrom
lane2/drag-icon-handle

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Original work by @ernestt. This pull request carries Ernest's commit from #11445 unchanged, plus commits on top, and supersedes #11445 (its branch does not accept maintainer edits). Ernest stays the co-author of the new commit. Owner: fix lane 2. Land path: normal review, then the merge queue; #11445 closes after this merges.

Reorder stack. Each pull request is based on the one before it.

  1. This pull request: a drag icon; the reorder handle draws it
  2. feat(List): createReorderable's handle option places the reorder handle, at the row's end by default #12146: createReorderable's handle option (placement, revealBehavior), superseding feat(List): the reorder handle starts its row and shows on hover or focus #11454 and feat(List): createReorderable's handle option places the reorder handle and sets how it reveals #11575
  3. Then, as its own pull request: the handle is its grip alone, with a 24px target (the geometry from feat(List): the reorder handle is its grip alone, with a 24px target #11583)
  4. fix(List): a mouse drop plays the same settle spring as a finger's drop #11600: a drop glides the rows into place with every pointer

Overlap checked: #11445, #11583, #12146, #11600, #10849, #11226 (#11445 is superseded, since its branch takes no maintainer edits; #12146 and #11600 build on this; #11583's grip geometry moves to its own pull request above #12146; #10849 and #11226 touch other reorder paths, not the grip, the icon registry, or ComponentIcon)

What changed on top of Ernest's commit

  • The grip renders through ComponentIcon. The handle used a copy of the shared slot renderer. It now renders <ComponentIcon slot="list-reorder-handle">. ComponentIcon takes an optional xstyle for the icon, so the grip still passes presses on to the handle.
  • FR5 counts what is added. spec:AST-103 FR5 now reads "Reordering adds at most one control to a row", and records the grip's artwork as the one architecture:component-style-authoring INV7 exception for a list row, with measured counts: a List row at rest has 2 elements below its <li> without reordering, and 11 with it (the handle, and its grip's wrapper, <svg> and six dots). A test keeps those counts. The verification row fails "more than one added control per row, an added element outside the handle, a grip that assistive technology reaches".
  • IconRegistry requires drag from 0.8.0. Until then a complete registry may omit it and the default grip fills in. architecture:icon-resolution-and-component-slots INV10, the type's comment and the Changeset say so.
  • List DD1 records the grip's look: the drag icon at the sm size in the secondary icon color, no hover fill.

User need

A reorderable collection's handle draws three horizontal lines. Core List draws it, and Lab's ListInput and TransferList use the same handle. On the web, three lines read as a menu: it is the same shape as the menu icon. People who see it expect a menu, not a grip. The glyph is also a fixed CSS drawing, so a theme or an app that wants another grip cannot change it.

Problem and solution fit

  • A shared drag icon. drag joins the semantic IconName set, with a six-dot grip as its built-in default. A theme or an app replaces it as it replaces any semantic icon: defineTheme({icons: {drag}}) or registerIcons({drag}). The bundled themes map it to Lucide's GripVertical. The CLI already ships a drag icon definition; it becomes a built-in definition.
  • A slot for the handle's grip. The handle draws its grip through a new component icon slot, list-reorder-handle, which falls back to drag. A theme replaces the grip for the handle alone with defineTheme({componentIcons: {'list-reorder-handle': …}}), as it does Table's sort indicator. null hides the grip and keeps the handle.
  • The handle draws it. The reorder handle draws the drag icon at the sm size (16px), as a bare glyph with no hover fill, in the handle's secondary icon color. The handle keeps its 28px box, its focus ring, its touch hit area, its reorder-mode fill, its keyboard path and its announcements.

Current specification

This pull request amends three records; the decisions to approve are those amendments. It conforms to three others without changing them.

Amended:

  • spec:AST-103 (reorderable collections) FR5: one added control per row, the grip's artwork inside the handle as the list row's INV7 exception, the measured counts, and the verification row above.

  • architecture:icon-resolution-and-component-slots INV10: a new shared IconName does not break a complete IconRegistry written before it; a complete registry maps drag from 0.8.0. The record's new cleanup entry CLN-0030 stages that 0.8.0 change: IconRegistry becomes Record<IconName, ReactNode> again, with its migration (add a drag entry to a registry typed as IconRegistry), rollback, and pending state for 0.8.0's [breaking] Changeset.

  • component:List: the additive theme surface line for componentIcons['list-reorder-handle'], the FR5 line now naming one control with its grip inside it, and DD1.
    Conforms to, unchanged:

  • spec:AST-084 (icon sets) FR4 and FR15: drag.doc.mjs gains builtIn: true, and every icon set maps drag.

  • spec:AST-082 (native-first surfaces) FR17: Apple maps drag to line.3.horizontal, the system's reorder glyph; Android maps it to drag_indicator.

  • architecture:public-component-api INV25: the public rows to approve are the IconName value 'drag', the ComponentIconSlotMap slot 'list-reorder-handle', and IconRegistry's drag entry, required from 0.8.0.

Public delta and caller burden

  • IconName gains 'drag'. defineTheme icons are a partial map, so no theme has to change. IconRegistry, the type of a complete registry, keeps drag optional until 0.8.0, so a registry typed with it still compiles (spec:AST-017 FR5). An omitted drag draws the default grip. From 0.8.0 a complete registry maps drag: the Changeset tells such a registry to add a drag entry, as the bundled themes do here.
  • ComponentIconSlotMap gains the stateless slot 'list-reorder-handle', listed in List's theming.componentIcons.
  • An icon set must map drag (AST-084 FR15). Until it does, integration check reports icon_builtin_definition_missing for it. That is a change to the experimental icon-set feature, so it has its own [experimental] patch Changeset for @astryxdesign/cli (spec:AST-084 FR0, spec:AST-017 FR22); the stable [feat] Changeset covers the rest.
  • The reorder handle draws the drag icon (before: three CSS lines). Its color stays --color-icon-secondary. No prop, size, focus, keyboard or announcement change.
  • ComponentIcon (internal) takes an optional xstyle for its icon.
  • Lab ListInput and TransferList show the new grip with no change of their own.
  • Native: IconName.drag joins the generated built-in names.
// A theme that wants a different grip everywhere:
defineTheme({icons: {drag: <GripHorizontal />}});
// Or only on the reorder handle:
defineTheme({componentIcons: {'list-reorder-handle': 'menu'}});

Design and alternatives

  • A slot alone, with no shared name: rejected. Drag handles appear across collections and in apps, and the CLI already defines drag for icon sets. The slot maps to the shared name (INV3).
  • The shared name alone, with no slot: rejected. INV10 gives a new Core icon role a slot, so a theme can change the handle's grip without changing every drag icon.
  • drag required in IconRegistry now: rejected. It would break every complete registry in a patch; it becomes required in 0.8.0.
  • Keep the CSS glyph: rejected. A theme cannot replace it.
  • Three lines or six dots: on the web, three lines are the menu glyph, and six dots are the common drag affordance. The Apple platform map keeps the system's three-line reorder glyph, where people expect it.

Evidence

Real Chromium, static Storybook builds of main and of this branch, at 2x. Captures are below.

First load

The drag artwork joins the default icon map that every page rendering an Icon loads. First-load JS gzip delta in bytes, Core built with its own build:esm at the base (48a3d9d) and at this head, each reference page bundled in production mode (React, React DOM and StyleX external). Chunk counts are unchanged, and deferred modules stay lazy:

Page Vite 8 Rolldown, inline off Rolldown, 64 KiB webpack 5
docs +36 +45 +35 +46
form +38 +43 +42 +48
menu +38 +39 +55 +29
table +41 +39 +40 +51
list +35 +39 +35 +44

Captures

List, at rest

main This branch
List, at rest, main List, at rest, this branch

List, pointer over a handle (no hover fill)

main This branch
List, pointer over a handle (no hover fill), main List, pointer over a handle (no hover fill), this branch

List, keyboard focus on a handle

main This branch
List, keyboard focus on a handle, main List, keyboard focus on a handle, this branch

List, reorder mode (the pressed fill stays)

main This branch
List, reorder mode (the pressed fill stays), main List, reorder mode (the pressed fill stays), this branch

List, dark mode

main This branch
List, dark mode, main List, dark mode, this branch

ListInput (Tag options), pointer over a record

main This branch
ListInput (Tag options), pointer over a record, main ListInput (Tag options), pointer over a record, this branch

ListInput (Tag options), keyboard focus on a handle

main This branch
ListInput (Tag options), keyboard focus on a handle, main ListInput (Tag options), keyboard focus on a handle, this branch

TransferList (Default)

main This branch
TransferList (Default), main TransferList (Default), this branch

Scope

Components: Icon, ComponentIcon, ComponentIconSlotMap, IconRegistry, List, ListInput, TransferList (shared reorder handle), themes, CLI icon definitions, native icon names

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Formatting note

packages/cli/assets/docs/icons.doc.mjs gains one row. Prettier also reindents the rest of that file: the file was not Prettier-formatted on main, and the commit hook formats every staged file.

Testing

At this head:

  • vitest run --project ui for Core List and Icon and Lab ListInput and TransferList: 20 files, 461 tests pass. New: the FR5 counts (2 elements below a plain row, 11 with reordering, 8 inside the handle).
  • Core typecheck, ESLint, Prettier, check:knowledge.

From Ernest's head, unchanged by the commit on top: the full ui project (1,023 files), the CLI isolation golden, the touch and reorder-mode interaction specs, and pnpm bundle:cli-themes and the native generator.

Writing rubric results

Records: docs/specs/AST-103-reorderable/spec.md (FR5 and its verification row), docs/architecture/icon-resolution-and-component-slots.md (INV10 and cleanup record CLN-0030), docs/specs/components/List/List.spec.md (the theme-surface line, the FR5 line, DD1).

  • R1 narration: none. Each amended sentence states what the system does, in the present tense.
  • R2 research: none.
  • R3 evidence: FR5 names measured counts and a test keeps them; its verification row names what fails.
  • R4 rejected alternatives: none in the records; they are in this description.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none in the amended text. The 0.8.0 requirement is a compatibility rule with a version, not status. The List record's older "first adopter" wording is outside the amended lines.

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. lane:2 Astryx fix-loop lane 2 owns this needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants