Skip to content

Design: hosting interactive Textual widgets per entry (widget overlay) #1

Description

@tya5

Context

The entry view is a rich.console.RenderableType, so display components
reuse cleanly today: Panel/Table/Syntax/Markdown and the built-in
indicators rich.spinner.Spinner / rich.progress_bar.ProgressBar drop
straight into a Presentation (see examples/progress.py). Light interaction
is covered by FlowView.Clicked hit-testing (see examples/intervention.py).

What is not covered: mounting real interactive Textual widgets
(Button, Select, Input) as an entry's body — FlowView paints renderables
to strips (that is what makes variable-height virtualization cheap) and does not
mount a child widget per row.

Decision needed

Do we add a way to host real Textual widgets for entries, and if so, how far?

Option A — don't (recommended default).
Keep the paint model. Interactivity via Clicked hit-testing + Rich
renderables. Matches how Textual's own OptionList/DataTable work (they paint
lines, no per-row widgets). Zero core risk.

Option B — bounded "active overlay".
Opt-in: an entry can host ONE real Textual widget, mounted as an overlay
positioned over its region only while visible, unmounted on scroll-away /
resolve. Gives real Button/Select/Input for the few entries that need it
(e.g. an intervention prompt) without mounting thousands. Cost: mount/position/
unmount lifecycle, scroll tracking, focus handling, state loss on unmount.

Option C — full per-entry widgets.
Rejected: defeats virtualization; mounting/unmounting on scroll is expensive and
loses state/focus.

Recommendation

Ship A now (already effectively done). Build B only when a concrete use case
needs true focus/keyboard interaction inside the flow, and keep it strictly
opt-in so the core paint path is untouched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions