Module Effect.FocusSource

Sourcetype nonrec t = {
  1. attr : Virtual_dom.Vdom.Attr.t;
  2. focus : unit Effect.t;
  3. blur : unit Effect.t;
}
Sourceval on_effect : ?name_for_testing:string -> unit -> t Bonsai.For_open.Computation.t

on_effect returns a Vdom.Attr.t and two unit Effect.ts that focus/blur the Vdom.Node.t containing the Vdom.Attr.t. The attr should not be used on more than one Vdom.Node.t, as only the first element will be focused/blurred when the effect runs.

When name_for_testing is provided, the focus and blur effects will print in test mode. They will be a no-op otherwise.

Sourceval on_activate : ?name_for_testing:string -> unit -> Virtual_dom.Vdom.Attr.t Bonsai.For_open.Computation.t

on_activate will focus the element that the returned attr is attached to when this computation is activated. See Bonsai.Edge for more details on the component lifecycle.

When name_for_testing is provided, the focus will print in test mode. It will be a no-op otherwise.