title: In an HTML embedding of a Jupyter widget that contains a Plotly FigureWidget, on_click callbacks don't work
body: <p>Here's a minimal example. It works perfectly in a Jupyter notebook, but when the html file is opened in a browser, clicking the plot produces no output.</p>
  <p>If <code>embed_minimal_html</code> is called after the widget has been used in the Jupyter notebook several times and output is present, the same output will appear in the opened html file (without the black border for some reason), but additional clicks will not produce additional output.</p>
  <pre><code>import plotly.graph_objects as go
  import ipywidgets as widgets
  from ipywidgets.embed import embed_minimal_html
  
  fig = go.FigureWidget(data=[go.Scatter(x=[1, 2], y=[1, 2])])
  scatter = fig.data[0]
  output = widgets.Output(layout={'border': '1px solid black'})
  
  @scatter.on_click
  def output_point(_, points, __):
      with output:
          print(&quot;Point: ({}, {})&quot;.format(points.xs[0], points.ys[0]))
  
  minimal_onclick_widget = widgets.VBox([fig, output])
  
  embed_minimal_html('minimal_onclick_widget.html', views=[minimal_onclick_widget], title=&quot;Minimal on_click widget&quot;)
  
  minimal_onclick_widget
  </code></pre>
  <p>Any ideas what's going on, or how to fix it?</p>
  <p>I think it might have something to do with server-side versus client-side event handling. The <code>link</code> and <code>dlink</code> widgets go through the Python kernel (server-side) and don't work in static html embeddings like the one above, but they have client-side alternatives <code>jslink</code> and <code>jsdlink</code> that do: <a href="https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Events.html#Linking-widgets-attributes-from-the-client-side" rel="nofollow noreferrer">https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Events.html#Linking-widgets-attributes-from-the-client-side</a>. It's not stated explicitly in the docs, but maybe <code>on_click</code> is a server-side event with no client-side alternative.</p>