panel icon indicating copy to clipboard operation
panel copied to clipboard

Tabulator widget accessible from other tab in `pn.Tabs`

Open maximlt opened this issue 2 years ago • 2 comments

Reporting a nasty but also somewhat funny bug, in which I can sort of click on a Tabulator widget that is in a pn.Tabs layout while displaying another tab (not sure it's a Tabulator issue, a Tabs issue, or both).

Kapture 2024-03-11 at 10 40 51

import panel as pn
import pandas as pd
import numpy as np

pn.extension('tabulator', notifications=True)

df = pd.DataFrame(np.random.random((10, 10)))

table = pn.widgets.Tabulator(df)

table.on_click(lambda e: pn.state.notifications.error(f"Oops {e}"))

app = pn.Tabs(("Tabulator", table), ("Other", "Click below to trigger notifications from the Tabulator widget in the other tab!"))
app.servable()

maximlt avatar Mar 11 '24 09:03 maximlt

It's not exclusive to Tabulator. It happens with links on Markdown panes, too, for example:

import panel as pn

md = pn.pane.Markdown("[LINK](https://www.example.com) " * 1000)

app = pn.Tabs(
    ("Markdown", md),
    ("Other", "Click below to trigger links of the other tab that is not active!")
)
app.servable()

MP-MaximilianLattka avatar Feb 21 '25 08:02 MP-MaximilianLattka

As you might expect, the parameter dynamic=True on Tabs (basically lazy-loading) acts as a workaround. It's not pretty though as it re-renders the content effectively. But it's worth mentioning, I suppose.

MP-MaximilianLattka avatar Feb 21 '25 08:02 MP-MaximilianLattka