Skip to content

Settings → Labels: reorder quick labels and edit their emoji - #1738

Merged
backnotprop merged 2 commits into
mainfrom
feat/quick-label-reorder-emoji
Oct 6, 2026
Merged

backnotprop merged 2 commits into
mainfrom
feat/quick-label-reorder-emoji

Conversation

@backnotprop

@backnotprop backnotprop commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1736

Settings → Labels (Quick Labels, plan review and annotate) now lets you reorder labels and change their emoji.

What changed

  • Reorder. Each row has Move up / Move down buttons (aria-label="Move <text> up|down", disabled at either end). A moved label carries its emoji, text, colour and tip, and the key hint on every row updates, because the list position is what decides the Alt/⌥ digit. After a move, focus stays on the same row's button, so pressing it again keeps moving the same label. A polite live region announces the new position and key ("Moved Verify this to position 1 of 10, Option+1").
  • Editable emoji. The emoji is now a small field. It accepts exactly one emoji grapheme, including ZWJ sequences, flags, keycaps and skin tones (parseQuickLabelEmoji). A new emoji picked or typed beside the old one also works, because the old one is set aside. Anything else (letters, two emoji, an empty field) shows as invalid with a hint naming the OS emoji picker. It is never saved, and the field reverts on blur or Escape. New labels still start as 📌, and their emoji can be changed straight away. Adding a label now focuses its text field.
  • Stable row identity (the [BUG] AI-instruction-tip (lightbulb) input glitches in Settings → Labels #829 bug class). The tab moved to components/settings/QuickLabelsTab.tsx. Rows are keyed by a session-only key, not by position or label.id, and the open tip editor and emoji drafts are tracked by that key. So after a move, typing, the tip editor and focus stay with the moved label. The key is deliberately not persisted: the saved plannotator-quick-labels value keeps exactly its old QuickLabel[] shape. Older readers see nothing new, and the cookie does not grow. The encoded defaults are already ~2.9 KB of the ~4 KB cookie limit, and a persisted key would have added ~300 B.
  • Duplicate ids. QuickLabelDropdown keyed rows by label.id, which is derived from the text, so two labels with the same text collided. It now keys by position. The list never reorders while it is open, and position is exactly what each row's digit names.
  • label.id semantics are unchanged: it is still re-derived from the text on edit, and new labels still get custom-<ts>. Annotations still store ${emoji} ${text} at creation, so a changed emoji affects only new annotations, the same as a text edit.
  • Shared helpers in utils/quickLabels: quickLabelShortcutDigit / quickLabelIndexForDigit (now used by the toolbar, the floating picker, the dropdown and Settings), moveQuickLabel, parseQuickLabelEmoji, emojiFromFieldInput. Additive only; documented in packages/ui/HANDOFF.md. Hosts (Workspaces) need no change.

Drag-and-drop was left out. The buttons are keyboard- and screen-reader-friendly, and an accessible drag-and-drop would not have been cheap.

Tests

  • packages/ui/components/settings/QuickLabelsTab.test.tsx (DOM-gated, added to the workflow's DOM_TESTS step). It drives the real Settings dialog and storage module, then the real AnnotationToolbar / Viewer:
    • Moving "Verify this" to the top: Alt+1 now applies it with its emoji, colour and tip, and Alt+2 / Alt+3 apply the shifted labels.
    • Editing the emoji: an invalid entry is not saved; a valid one is saved, and a new annotation made with Alt+1 in a real Viewer reads 🤔 Clarify this.
    • Editing the text, opening the tip editor, then moving: the tip editor and the same text input stay on the moved row, and further typing and the saved tip land on the moved label, not on its neighbour.
    • Two labels with the same text: both render, React reports no duplicate-key warning, and editing or opening the tip editor on the second one affects only that one.
    • Mutation-checked: putting back key={label.id} in the dropdown, or key={index} on the Settings rows, makes the matching test fail.
  • packages/ui/utils/quickLabels.test.ts: emoji validation, field-input resolution, move and digit mapping.

Checks

  • DOM_TESTS=1 bun test --isolate packages/ui packages/editor: 2596 pass, 0 fail
  • bun test packages/ui packages/editor scripts: 0 fail (includes the DOM allowlist guard)
  • bun run typecheck: clean
  • Builds: apps/review, build:hook, build:opencode, build:portal
  • apps/guides-show build:viewer + check:manifest: in sync. No new Tailwind classes reach the viewer CSS; the invalid-emoji ring is an inline style.

Screenshots (light / dark, default and after a move with the tip editor open and an invalid emoji draft) were captured locally at /tmp/labels-ui/.

Narrow screens (follow-up commit)

On narrow viewports the row's overflow-hidden used to clip the new controls. Now:

  • The text field can shrink (min-w-0) and has an 8rem flex basis.
  • The row wraps, so when there isn't room the tip, colour, reorder and remove controls move to a second line.
  • The ⌥N hint is hidden below sm.

Checked in headless Chromium at 360, 390, 600 and 900px with a tip editor open: every control sits fully inside its row, nothing is off-screen, and the text field is at least 194px wide. Screenshot: /tmp/labels-ui/labels-390.png. check:manifest is still in sync.

Settings → Labels gains move up/down buttons per row (the order decides the
Alt/⌥ digit) and an editable one-emoji field. Rows get a session-only stable
identity so typing, the tip editor and focus follow a moved row; the dropdown
keys by position so labels with the same text no longer collide. The saved
QuickLabel[] shape is unchanged.

Fixes #1736
The text field can shrink (min-w-0) and carries an 8rem flex basis; the row
wraps, so when it cannot give the text that much room the tip, colour,
reorder and remove controls move to a second line instead of being clipped.
The Alt/Option key hint is hidden below sm.
@backnotprop
backnotprop merged commit a55386b into main Oct 6, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings → Labels: no way to reorder quick labels or change their emoji

1 participant