Skip to content

feat: support multiple independent Board instances (v0) [WIP] - #448

Draft
ernst-dev wants to merge 1 commit into
mainfrom
feat/board-multi-instance-wip
Draft

feat: support multiple independent Board instances (v0) [WIP]#448
ernst-dev wants to merge 1 commit into
mainfrom
feat/board-multi-instance-wip

Conversation

@ernst-dev

Copy link
Copy Markdown
Member

Description

[WIP / first-cut v0] Enables multiple independent Board instances on a single page.

Today the drag-and-drop DragAndDropController is a module-level singleton shared by every Board/ItemsPalette on the page (src/internal/dnd-controller/controller.ts). All droppables register into one shared registry, so collisions and drops "leak" between boards and independent boards cannot be isolated.

This change makes the DnD controller context-scoped and adds an opt-in provider:

  • DragAndDropController is now exported and the DnD hooks (useDragSubscription, useDraggable, useDroppable) read their controller from a new React context (DndControllerContext).
  • The context defaults to the existing global singleton, so all current usages are unchanged (fully backward-compatible).
  • New internal DndContextProvider mints a dedicated controller per subtree.
  • New public, opt-in BoardDndProvider component wraps board components in an isolated DnD context:
    • Wrap each board in its own BoardDndProvider → boards are fully isolated.
    • Wrap several boards (and/or a palette) in one BoardDndProvider → they share a context and items can be dragged between them.
    • No provider → unchanged page-wide behavior.
  • The provider wrapper uses display: contents so it is layout-neutral.

This is additive and opt-in. It is a coherent, buildable v0 to unblock the epic; it is not feature-complete (see remaining work).

Related links, issue #, if available: Tracking SIM AWSUI-56573.

⚠️ Ticket mismatch: AWSUI-56573 in Taskei currently resolves to an unrelated "Aperture Form Submission" (a Console visual-appearance opt-out feedback entry), not the Board multi-instance epic. Implemented per the assigned epic description; please re-point the tracking ID if needed.

Done in this PR (v0)

  • Context-scoped DnD controller with singleton fallback (backward-compatible).
  • DndContextProvider (internal) + public BoardDndProvider (+ interfaces, styles, index export).
  • Test-utils wrapper (findBoardDndProvider / findAllBoardDndProviders).
  • Dev page: pages/board-dnd-provider/multi-instance.page.tsx (isolated boards + shared group).
  • Unit tests for context isolation and per-instance controller registry.
  • Regenerated documenter + test-utils API-doc snapshots for the new component.

Remaining work (follow-ups, out of scope for v0)

  • Functional/visual e2e coverage proving pointer + keyboard DnD isolation across instances (drag between vs. isolate).
  • Keyboard/screen-reader insertion across boards within a shared provider; announcements review.
  • Auto-scroll / global drag-state styles are still partly global — audit for per-context scoping.
  • Public API documentation (Usage tab) and examples.
  • Decide the final public surface (dedicated BoardDndProvider vs. a prop on Board) and naming with the team.
  • SSR/multiple-React-context edge cases; per-instance item identity guarantees when IDs collide across boards.

How has this been tested?

  • npm run build — green.
  • npm run test:unit336 passed / 34 files (incl. new dnd-context tests; snapshots regenerated).
  • eslint .0 errors (pre-existing warnings only).
  • Manual: new dev page renders two isolated boards + one shared palette/board group.
  • Not run here: test:functional / test:visual (Puppeteer e2e) — tracked as follow-up.
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates. (partial — API docs follow-up)
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md. (yes — context defaults to the existing singleton)
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines. (follow-up)

Security

  • If the code handles URLs: all URLs are validated through the checkSafeUrl function. (n/a)

Testing

  • Changes are covered with new/existing unit tests? (yes)
  • Changes are covered with new/existing integration tests? (follow-up)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.17%. Comparing base (f388073) to head (5672125).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #448      +/-   ##
==========================================
+ Coverage   91.44%   92.17%   +0.73%     
==========================================
  Files          59       62       +3     
  Lines        1730     1751      +21     
  Branches      467      468       +1     
==========================================
+ Hits         1582     1614      +32     
+ Misses        148      137      -11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ernst-dev ernst-dev changed the title feat: support multiple independent Board instances [WIP] feat: support multiple independent Board instances (v0) [WIP] Jul 23, 2026
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.

1 participant