Skip to content

M6 design: overlays (docs/overlays.md) - #101

Merged
samitbasu merged 2 commits into
mainfrom
m6-overlay-design
Nov 11, 2026
Merged

samitbasu merged 2 commits into
mainfrom
m6-overlay-design

Conversation

@samitbasu

Copy link
Copy Markdown
Owner

Design note for M6 overlays, for the user to approve (not the build). See docs/overlays.md. It includes 19 prototype tests (marked) that pin egui stacking and modality facts and the placement rules. Decisions needed are listed at the end of the note.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up

docs/overlays.md answers the M6 design questions (tree model, stacking,
placement, dismissal, focus, modals, sheets and #35, scroll, drag and drop,
migrations, look, testing), sketches the API and proposes a 7-PR build order.

The prototypes settle questions with evidence and are marked as such:
- tests/it/overlay_egui_evidence.rs: how egui orders layers (move_to_top is
  a flag, so D18's "build order every frame" does not restack), what
  set_modal_layer does and does not block, that Esc blurs focus inside egui,
  that a press keeps its origin through a drag, and that a screen-sized
  layer takes the wheel from the page.
- tests/it/overlay_placement_prototype.rs: the pure placement function and
  its test matrix (12 tests), to be moved into the library by the build.

No library behaviour changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
@samitbasu

Copy link
Copy Markdown
Owner Author

Decisions so far (2026-11-11):

  • Tooltips: migrate onto eggshell overlays with the shadcn tooltip look (last M6 PR; look shown as renders for approval).
  • Stock menu widgets (item, separator, submenu, WAI-ARIA keyboard nav) are in v0.1.
  • Submenus open on click and keyboard only, no hover-open in v0.1.
  • Architecture items 1–8: under discussion, one at a time.

@samitbasu

Copy link
Copy Markdown
Owner Author

Decisions (2026-11-11, continued):

  • Item 1 (tree model): agreed. Same tree, separate root, one Placed. Drag and drop across separate layout scopes (Placed) #85 re-scoped to 'across separate Placed', M6 label dropped.
  • Item 2 (stacking): agreed. Bands Floating/Popup/Tooltip; D18 amended to band, then opening order, nested above parent; no .raise().
  • Correction found in review: egui's layer order never forgets a layer, so a reopened overlay keeps its stale rank (§2's guarantee is false for reopen). Fix chosen: B, a repair step. The library keeps its own stack D in opening order; each frame it flags D[k..], where k is the longest prefix of D already in egui's relative order (lowered to the pressed overlay's index on a press). The prefix grows every frame, so it can't oscillate; realistic cases converge in 1 frame, and egui sorts before painting, so the fix shows in the same frame. Replaces 'flag every overlay every frame'. PR 2 adds tests for reopen, press-on-parent and a convergence property test.
  • Item 3 (modals): agreed. Own scrim plus set_modal_layer; Modal::Center/Edge as an overlay variant (typestate), not egui::Modal.

@samitbasu

Copy link
Copy Markdown
Owner Author

Item 4 (enter/exit motion): agreed, revised shape. No free-standing Presence::drive. Presence lives on the overlay chain: .shown(Shown) (required), .transition(Duration), .ease_*(), .entrance(Entrance), .on_exited(|app| ..). The library owns the phase (Closed|Entering|Open|Exiting) and reuses transition.rs's retargetable eased Progress (no second animation clock). children isn't called while fully closed. An exiting overlay is inert but still blocks. A payload whose data the action removes is cleared in on_exited. #35 (ghosts) is not an M6 dependency.

@samitbasu

Copy link
Copy Markdown
Owner Author

Item 5 (dismissal): agreed as written in §4: one pure function, judged at the press, the anchor counts as inside, Esc topmost only, nothing judged during a drag, focus-out closes menus/popovers, window blur closes non-modal, scroll never closes, activation is the app's handler; DismissOn { Default, EscOnly, Never }.

@samitbasu

Copy link
Copy Markdown
Owner Author

Item 6 (scroll): agreed as in §8: follow in the same frame, hide (keep state and stack slot) when the anchor is fully clipped, never close on scroll; Point/Pointer anchors are screen-fixed; a tall list is clamped to the available room and scrolls; one Placed::root_at shared by DnD, dismissal and hover (also the home for #102's blocking rule).

@samitbasu

Copy link
Copy Markdown
Owner Author

Item 8 (stock widget state): agreed. Stock Select, dropdown/context menus and tooltips own their open state in egui temp data keyed by the widget id; the stock menu closes on item activation; no controlled mode (open/on_open_change) in v0.1, addable later without breaking.

Stacking gains a repair step (egui never forgets a layer's rank, so a
reopened overlay would keep a stale place); presence moves onto the
overlay chain (.shown/.transition/.entrance/.on_exited); submenus open
on click and keyboard only in v0.1; tooltips migrate; stock widgets own
their open state. The note now states the approved design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKe8zfqGfVMCSC5L3up
@samitbasu
samitbasu marked this pull request as ready for review November 11, 2026 21:45
@samitbasu
samitbasu merged commit b768b2e into main Nov 11, 2026
3 checks passed
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