Skip to content

feat(composer): drag-to-reorder To/Cc/Bcc recipient chips (#593)#605

Merged
rathlinus merged 1 commit into
bulwarkmail:mainfrom
hildebrandttk:feat/reorder-recipients-593
Jul 13, 2026
Merged

feat(composer): drag-to-reorder To/Cc/Bcc recipient chips (#593)#605
rathlinus merged 1 commit into
bulwarkmail:mainfrom
hildebrandttk:feat/reorder-recipients-593

Conversation

@hildebrandttk

Copy link
Copy Markdown
Contributor

Summary

Recipient chips could already be dragged between the To/Cc/Bcc fields, but a drop always appended and same-field drops were a no-op, so recipients could not be rearranged without deleting and re-adding them.

Add positional drag-and-drop: while dragging a chip, an insertion caret shows the gap it would land in (based on which half of the hovered chip the pointer is over, mirrored for RTL); dropping inserts it there.

Changes

  • same-field drop reorders the chip locally (via onChipsChange), using the source index carried in the drag payload (fromIndex) and adjusting for the removal shift; dropping onto its own position is a no-op;
  • cross-field drop inserts at the drop position: handleMoveChip gained an optional toIndex (omitted = append, e.g. dropping onto a hidden Cc/Bcc button, preserving existing behaviour);
  • per-chip onDragOver computes the target gap; the container handles the trailing gap (past the last chip / over the input).

Tests (components/email/tests/recipient-chip-drag.test.tsx): reorder to end / front, self-drop no-op, cross-field positional insert, and caret visibility. Also add the missing findComposeIdentityId export to the reply-identity mock in the recipient drag/paste suites so mounts in compose mode.

Related Issues

Closes #593

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactor / code quality improvement
  • Chore / dependency update / CI change

Checklist

  • I have read the Contributing Guide
  • My code follows the project's code style and conventions
  • I have run npm run typecheck && npm run lint and there are no errors
  • The build passes (npm run build)
  • I have tested my changes locally
  • I have added or updated documentation if needed
  • I have updated translations (locales/) if my changes affect user-facing text
  • I have included screenshots or a screen recording for UI changes

Screenshots / Demo

593.webm

Notes for Reviewers

…l#593)

Recipient chips could already be dragged between the To/Cc/Bcc fields, but a
drop always appended and same-field drops were a no-op, so recipients could not
be rearranged without deleting and re-adding them.

Add positional drag-and-drop: while dragging a chip, an insertion caret shows
the gap it would land in (based on which half of the hovered chip the pointer
is over, mirrored for RTL); dropping inserts it there.

- same-field drop reorders the chip locally (via onChipsChange), using the
  source index carried in the drag payload (fromIndex) and adjusting for the
  removal shift; dropping onto its own position is a no-op;
- cross-field drop inserts at the drop position: handleMoveChip gained an
  optional toIndex (omitted = append, e.g. dropping onto a hidden Cc/Bcc
  button, preserving existing behaviour);
- per-chip onDragOver computes the target gap; the container handles the
  trailing gap (past the last chip / over the input).

No new user-facing strings (the caret is purely visual), so no locale changes.

Tests (components/email/__tests__/recipient-chip-drag.test.tsx): reorder to end
/ front, self-drop no-op, cross-field positional insert, and caret visibility.
Also add the missing findComposeIdentityId export to the reply-identity mock in
the recipient drag/paste suites so <EmailComposer> mounts in compose mode.
@rathlinus
rathlinus merged commit 3715250 into bulwarkmail:main Jul 13, 2026
@hildebrandttk
hildebrandttk deleted the feat/reorder-recipients-593 branch July 14, 2026 19:34
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.

[Feature]: Reorder-ability of To/CC/BCC recipients

2 participants