Onscroll event listener no longer working on NotebookPanel

Hi, after updating to the newest JupyterLab version, my previous code which listens to the scroll event on NotebookPanel stopped working.

notebookPanel.node.addEventListener('scroll', (() => console.log("hi")))

If I substitute ‘scroll’ with ‘click’, it works normally.

I tried to create a new extension with a clean environment and could reproduce this problem.

I wonder if this is because of some changes in the API from 4.0.x to the current version. If so, what is the best way to listen to the scroll event after the update?

1 Like

Yes, two things:

    1. the scroller node is different in JupyterLab 4.1 going forward, see this section in extension migration guide; this is one of change to accomodate creation of minimap
    1. in JupyterLab 4.2 the “full” windowing mode is on by default. It might have an impact on your listener too - easy to test by switching it off in the Notebook settings (or toggling it on in an older verion of JupyterLab).
1 Like