Incorrectly scaled plot output with ipympl and html export when browser magnification changed

I’m using JupyterLab in a class with matplotlib and ipympl (%matplotlib widget) to make interactive plots. We ask students to export their notebooks to html and submit them to a learning management system.

A problem we’ve been running into is that for many students, the plots that appear in their exported html are much larger than they should be, and are often truncated so only one corner can be viewed.

It looks like the issue has to do with the resolution and magnification in the browser. I can reproduce the problem if I increase the magnification of my browser window, run the notebook and export. Then the plots that appear in the exported html are scaled up and cropped. Reducing the browser magnification and re-running the notebook before exporting solves the problem.

This doesn’t seem to be a problem without ipympl, the plot images then seem to be scaled properly no matter the browser magnification.

It feels like this is a bug, though I’m not sure if it is in nbconvert, ipympl, or ipywidgets (or ?).

Any insight that can be offered would be appreciated!