Byo_toplayer_private_floatingDo not use this library directly! Use Byo_toplayer instead.
module Position : sig ... endmodule Alignment : sig ... endmodule Offset : sig ... endmodule Match_anchor_side : sig ... endmodule Anchor : sig ... endval position_within_viewport :
Js_of_ocaml.Dom_html.element Js_of_ocaml.Js.t ->
Anchor.t ->
unitAbsolutely positioned popovers start at the top left corner of the viewport before autopositioning kicks in. If the popover is focused via autofocus or Effect.Focus.on_activate, and the popover has position:absolute, and autopositioning has not yet completed, this focusing will scroll the page to the top.
Because floating UI positioning is asynchronous, we always need to pre-position the popovers into the viewport before opening it.
position_within_viewport should be called on any toplayer element that can be focused and is positioned via floating positioning, before it is opened.
val position_me :
?prepare:(Js_of_ocaml.Dom_html.element Js_of_ocaml.Js.t -> unit) ->
?arrow_selector:string ->
?position:Position.t ->
?alignment:Alignment.t ->
?offset:Offset.t ->
?match_anchor_side_length:Match_anchor_side.t ->
Anchor.t ->
Virtual_dom.Vdom.Attr.tposition_me returns an attr which, when added to a vdom node, will automatically position it relative to the anchor, with auto-update.
If provided, prepare will run once befre positioning is applied, when the element is mounted. The most common use case is opening a popover before starting autopositioning to avoid a flicker.
If match_anchor_side_length is set to true, the popover's main axis (width if position is Top/Bottom, height if position is Left/Right) will be set to have a length equal to the corresponding axis of the anchor. This is particularly useful for dropdowns and typeaheads.
module Accessors : sig ... endmodule For_testing_position_me_hook : sig ... end