noCV
PDOC-102 · Establish document operations

Make Find next follow document order through collapsed sections

Practice briefBugFoundational

Find next walks visible DOM elements, so collapsing a section removes its paragraphs from search. Keyboard users cannot tell whether a result was skipped or the query ended.

Focused work estimate
2h + prerequisites
Priority in the scenario
Medium
Engineering practice
Iterators · Keyboard interaction · State invalidation

Estimated field mix

  • Frontend60%
  • Accessibility40%

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

  • IteratorApply

    Traverse the document model in a stable order so search behavior does not change when presentation hides a section.

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

  • Traverse paragraph text in document preorder, independent of collapsed presentation state.
  • Find next visits each matching node once, wraps explicitly, and reports position and total through an accessible status message.
  • An empty query yields no results; a removed node cannot remain the active match after document revision changes.

Implementation constraints

  • Use an Iterator or generator over a stable document snapshot; do not query the DOM to discover content.

Verification to include

  • Find a match inside a collapsed section and verify the section opens and focus moves to its paragraph control.
  • Delete the active result and change the query to no matches; confirm stale focus targets and counts are cleared.

Deliverables

  • Snapshot traversal and keyboard search regression

Rollout and recovery

Replace local search traversal while retaining the existing search control; fall back to document start when no prior result identity survives.

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.