Toggle ToolbarBox visibility problem


I have a gridplot layout which for which I would like to turn on/off the toolbar upon click. I tried the following code:

# layout creation
grid = gridplot([
              [ plot1, plot3, plot5, plot7 ],
              [ plot2, plot4, plot6, plot8 ] ],
              plot_width=PLOT_WIDTH, plot_height=PLOT_HEIGHT, toolbar_location='above', sizing_mode='scale_width')

# code that runs on the handler of a button click
grid.children[0].visible = False # makes the toolbar disappear
grid.children[0].visible = True # does NOT bring it back

Interestingly, if I switch the inline style, on the browser, back and forth between “none” and “block”, the toolbar appears and disappears correctly.

Any idea?

Thank you,

No idea without more code to actually investigate. Please provide a complete Minimal Reproducible Example.