noCV
PDOC-103 · Establish document operations

Route toolbar and keyboard deletion through one command

Practice briefBugIntermediate

Toolbar deletion removes an entire selected section, but the keyboard shortcut deletes only its heading and leaves orphaned paragraphs. The two handlers also record different undo entries.

Focused work estimate
2h 30m + prerequisites
Priority in the scenario
High
Engineering practice
Command modeling · Atomic state updates · Interaction testing

Estimated field mix

  • Frontend70%
  • Quality engineering30%

Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.

Pattern topics

  • CommandApply

    Represent deletion as one validated document operation shared by toolbar, keyboard, and history so entry points cannot diverge.

Your next step

Review it, then add it to your workspace.

The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.

Project context

A fictional support team edits reusable troubleshooting documents with paragraphs, links, and nested sections. The browser prototype has separate toolbar and keyboard handlers, an unreliable undo stack, and mutable shared formatting objects. Create a local editor and synthetic documents; no starter assets, rich-text engine, collaborative backend, or production service is supplied.

Setup prerequisites

  • Browser events
  • Immutable updates
  • Accessible form controls

Preceding work

Complete these dependencies, or supply their agreed outputs before taking this ticket.

Acceptance criteria

  • Both entry points issue one document command with target identity and expected document revision.
  • Deleting a section removes its subtree atomically, updates selection to a documented surviving neighbor, and creates one history entry.
  • Stale, missing, and protected-root targets return explicit failures with no document or history change.

Implementation constraints

  • Command execution belongs outside presentation event handlers; do not store DOM references in history.

Verification to include

  • Delete the same nested section through toolbar and keyboard and compare document, selection, and history results.
  • Issue deletion against an old revision and the protected root; assert no partial update.

Deliverables

  • Shared delete command and entry-point parity tests

Rollout and recovery

Move both handlers in one local change to prevent mixed semantics; retain saved synthetic documents for replay if the command is reverted.

Value of the work

For the engineer: Practice relating object and state patterns to real UI behavior, including undo semantics, bounded traversal, lifecycle cleanup, and memory tradeoffs.

For the team: Review whether editor changes preserve user work, keep controls consistent, and reduce maintenance effort without concealing document corruption.

Evidence boundaries

Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.

Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.