Events in Python when renderer='browser'

I use a Gantt diagram like:

import plotly.express as px
import plotly.io as pio
import pandas as pd

pio.renderers.default = 'browser'

df = pd.DataFrame([
    dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Resource="Alex", Group=1),
    dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Resource="Alex", Group=2),
    dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30', Resource="Max", Group=1)
])
fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color="Resource")
fig.show()

And on hover event on a task (a rectangle in the chart), I would like to temporarily decrease the opaqueness of all tasks, which are in a different group than the hovered task (the task group is defined by Group column in the dataframe).

However, how can I define the callback?

A similar but unanswered question is Click Event for Gantt Chart - Python.