Skip to content

One options layer for owned controls: Options, Configure/Interactive traits, refused(reason), when/when_some #315

Open

Description

@samitbasu

A proposal from a consumer port (written against v0.1.0-m8.26).

Problem: each owned control's chain implements the common options (`named`, `tooltip`, `enablement`, `size`, `classes`, `on_response`) as its own inherent methods, with its own fields and docs. The copies have drifted:

  • Gaps: radio and segmented have no `named`; text_field has no `tooltip` or `enablement`; radio has no `tooltip`; dropdown has no `tooltip`; custom has no `enablement`.
  • `classes` merges on button, toggle and dropdown, but replaces everywhere else.
  • `Enablement` is `Option` in ButtonOptions but plain elsewhere.
  • `on_x_with` (handlers that get the Context) exists only on button and segmented.

Two things can't be done well at the call site: disabling a control and saying why in one step, and adding an option only when a condition holds. The consumer has ~10 rebind-to-add-a-tooltip sites, 2 bool→Enablement helpers, and 7 inline conversions.

Proposal (staged):

  1. Additive:
    • `IntoTip` (text or `Option` of text);
    • `refused(reason)`: disabled, with the reason as its tooltip and accessible description, while `Some`;
    • `when(cond, f)` and `when_some(opt, f)`;
    • fill the matrix gaps;
    • (`From for Enablement`, under discussion).
  2. One breaking tag:
    • the chains hold one `Options` value (ButtonOptions = Options + button extras);
    • traits `Configure` / `Interactive` / `Respond` with provided methods, and a `prelude`;
    • `classes` merges everywhere.
  3. Uniform handlers: `on_x_with` on every terminator; `FieldEvents` and `Focus` traits; `NodeHandle::on_response` takes `Fn`.

Since m8.26, the proposal needs reconciling with:

Open questions (the user decides):

  • whether the refusal replaces the tooltip or follows it;
  • whether the refusal is the AccessKit description;
  • whether `refused(None)` clears a refusal;
  • whether a disabled text field is readonly or fully inert;
  • whether custom nodes are `Interactive`;
  • `NodeHandle`/`Choice` and refused;
  • traits plus a prelude, or a macro;
  • `classes` merging everywhere.

Activity

  1. added
    consumer
    on Nov 17, 2026
  2. samitbasu commented on Nov 18, 2026

    @samitbasu
    OwnerAuthor

    Decisions (user, 2026-11-17/18):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    consumer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions