Ipywidgets Tab & FigureWidget inconsistent sizing

In JupyterLab, when putting go.FigureWidget objects into tabs of ipywidgets.Tab, the figure in the first tab automatically spans the whole tab area, but figures in other tabs donโ€™t, even if the same figure.

This happens only in JupyterLab and not in JupyterNotebook (where no figure automatically resizes).

Code to reproduce:

import ipywidgets as widgets
import plotly.graph_objects as go

fig = go.FigureWidget(data=go.Bar(y=[2, 3, 1]))
tab = widgets.Tab([fig, fig, fig])

Iโ€™m not sure if that comes from JupyterLab or from plotly though.

In case anybody else runs into this problem, the following code solved the problem for me

def on_tabs_change(change):
    f2.layout.autosize = True

f1 = go.FigureWidget()
f2 = go.FigureWidget()
tabs = widgets.Tab(
    children=[f1, f2]
tabs.observe(on_tabs_change, names='selected_index')