### Bug description

I don't seem to be able to capture `on_selection()` or `on_click()` events for interactive plots with plotly. I've tried both native `.qmd` files and Quarto snippets inside jupyter notebooks in VSCode, by trying to display outputs with `fig.show()`. 

However, the events do get captured correctly inside the notebook cell output when the output is displayed with just `fig` (as the last line of the cell). But, HTML render still fails to capture the events, even in this case.

### Steps to reproduce

````qmd
---
title: Quarto Unable to Capture Click Events
jupyter: python3
---

## Combining Parcats with Scatter
Check out [Parallel Categories Linked Brushing section for source](https://plotly.com/python/parallel-categories-diagram/)

```{python}
import plotly.graph_objects as go
from ipywidgets import widgets
import pandas as pd
import numpy as np

cars_df = pd.read_csv(
    "https://raw.githubusercontent.com/plotly/datasets/master/imports-85.csv"
)

# Build parcats dimensions
categorical_dimensions = ["body-style", "drive-wheels", "fuel-type"]

dimensions = [
    dict(values=cars_df[label], label=label) for label in categorical_dimensions
]

# Build colorscale
color = np.zeros(len(cars_df), dtype="uint8")
colorscale = [[0, "gray"], [1, "firebrick"]]

# Build figure as FigureWidget
fig = go.FigureWidget(
    data=[
        go.Scatter(
            x=cars_df.horsepower,
            y=cars_df["highway-mpg"],
            marker={"color": "gray"},
            mode="markers",
            selected={"marker": {"color": "firebrick"}},
            unselected={"marker": {"opacity": 0.3}},
        ),
        go.Parcats(
            domain={"y": [0, 0.4]},
            dimensions=dimensions,
            line={
                "colorscale": colorscale,
                "cmin": 0,
                "cmax": 1,
                "color": color,
                "shape": "hspline",
            },
        ),
    ]
)

fig.update_layout(
    height=800,
    xaxis={"title": "Horsepower"},
    yaxis={"title": "MPG", "domain": [0.6, 1]},
    dragmode="lasso",
    hovermode="closest",
)


# Update color callback
def update_color(trace, points, state):
    # Update scatter selection
    fig.data[0].selectedpoints = points.point_inds

    # Update parcats colors
    new_color = np.zeros(len(cars_df), dtype="uint8")
    new_color[points.point_inds] = 1
    fig.data[1].line.color = new_color


# Register callback on scatter selection...
fig.data[0].on_selection(update_color)
# and parcats click
fig.data[1].on_click(update_color)

# Doesn't capture click events in VSCode Jupyter Notebook
# fig.show(renderer="plotly_mimetype+notebook_connected")

# Doesn't capture click events in .qmd
fig.show()
```
````

### Expected behavior

When you select points in the scatter plot, the corresponding rows should be highlighted in the parcats plot and when you click on the parcats plot, the corresponding points should be highlighted in the scatter plot

![](https://user-images.githubusercontent.com/15064365/48087050-4a3eae80-e1cc-11e8-94c9-c0ffcedd3aa9.gif)

### Actual behavior

While you can select points in the scatter plot, the corresponding data points do not get highlighted in the parcats plot

<img width="767" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/16181437/50eecce9-d2ef-4fe7-a16f-5b11d1dbdd88">


### Your environment

- IDE: VSCode
- Quarto: 1.3.361
- Python: 3.9.16
- OS: Linux 8bed2c0d09ad 5.19.0-40-generic # 41~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 31 16:00:14 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- plotly: 5.14.1

### Quarto check output

```bash
quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.361
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.16
      Path: /home/user/venv/bin/python
      Jupyter: 5.3.0
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
```
cscheid
2023-06-06T16:57:13Z
saeejithnair
bug jupyter plotly
v1.4
open
Unable to capture plotly click events  
https://github.com/quarto-dev/quarto-cli/issues/5834