Repository navigation
Settings → Labels: reorder quick labels and edit their emoji - #1738
Merged
Merged
Conversation
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.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1736
Settings → Labels (Quick Labels, plan review and annotate) now lets you reorder labels and change their emoji.
What changed
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").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.components/settings/QuickLabelsTab.tsx. Rows are keyed by a session-only key, not by position orlabel.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 savedplannotator-quick-labelsvalue keeps exactly its oldQuickLabel[]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.QuickLabelDropdownkeyed rows bylabel.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.idsemantics are unchanged: it is still re-derived from the text on edit, and new labels still getcustom-<ts>. Annotations still store${emoji} ${text}at creation, so a changed emoji affects only new annotations, the same as a text edit.utils/quickLabels:quickLabelShortcutDigit/quickLabelIndexForDigit(now used by the toolbar, the floating picker, the dropdown and Settings),moveQuickLabel,parseQuickLabelEmoji,emojiFromFieldInput. Additive only; documented inpackages/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 realAnnotationToolbar/Viewer:🤔 Clarify this.key={label.id}in the dropdown, orkey={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 failbun test packages/ui packages/editor scripts: 0 fail (includes the DOM allowlist guard)bun run typecheck: cleanapps/review,build:hook,build:opencode,build:portalapps/guides-showbuild: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-hiddenused to clip the new controls. Now:min-w-0) and has an 8rem flex basis.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:manifestis still in sync.