Skip to content

Commit 58e9740

Browse files
authored
Merge pull request #18665 from meeseeksmachine/auto-backport-of-pr-18639-on-v3.3.x
Backport PR #18639 on branch v3.3.x (nbagg: Don't close figures for bubbled events.)
2 parents ab11910 + 29139a1 commit 58e9740

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/backends/web_backend/js/nbagg_mpl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mpl.mpl_figure_comm = function (comm, msg) {
4848
console.error('Failed to find cell for figure', id, fig);
4949
return;
5050
}
51-
fig.cell_info[0].output_area.element.one(
51+
fig.cell_info[0].output_area.element.on(
5252
'cleared',
5353
{ fig: fig },
5454
fig._remove_fig_handler
@@ -181,6 +181,10 @@ mpl.figure.prototype._init_toolbar = function () {
181181

182182
mpl.figure.prototype._remove_fig_handler = function (event) {
183183
var fig = event.data.fig;
184+
if (event.target !== this) {
185+
// Ignore bubbled events from children.
186+
return;
187+
}
184188
fig.close_ws(fig, {});
185189
};
186190

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy