Warning: Reason support is experimental. We are looking for beta-tester and contributors.

How to stop default behaviour of events?

Example:

(** Disable Js event with stopping propagation during capture phase **)
let disable_event event html_elt =
  Lwt.async (fun () ->
   Lwt_js_events.seq_loop
     (Lwt_js_events.make_event event) ~use_capture:true html_elt
     (fun ev _ -> Dom.preventDefault ev; Lwt.return ())))


disable_event Dom_html.Event.dragstart Dom_html.document
  • event is a Dom_html.Event
  • html_elt is the target

More details in documentation: Dom. preventDefault