Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flickering notebook toolbar items when resizing the window #7311

Closed
jtpio opened this issue Apr 2, 2024 · 9 comments · Fixed by jupyterlab/jupyterlab#16111 or #7319
Closed

Flickering notebook toolbar items when resizing the window #7311

jtpio opened this issue Apr 2, 2024 · 9 comments · Fixed by jupyterlab/jupyterlab#16111 or #7319
Labels

Comments

@jtpio
Copy link
Member

jtpio commented Apr 2, 2024

Resizing the browser changes the position of the notebook toolbar items:

resize-notebook-toolbar.webm

However this does not seem to be an issue with JupyterLab:

resize-jupyterlab-notebook.webm
@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to issues that need triage label Apr 2, 2024
@jtpio
Copy link
Member Author

jtpio commented Apr 2, 2024

cc @brichet who may have an idea about what might be causing this behavior

@brichet
Copy link
Contributor

brichet commented Apr 2, 2024

Thanks @jtpio for the ping.
I can't reproduce it locally, but can you try resizing using a sidebar instead of the development tools of the browser ?
I'm asking that to know if this can be due to the computation of the items widths.

Computing the size of the toolbar items is quite long because it requires them to be displayed.
To avoid this computation, this widths are stored on first computation, and reused to set the position of the items https://github.com/jupyterlab/jupyterlab/blob/634cc3a8ccedf5ea79987f5bf9faa0bede83935f/packages/ui-components/src/components/toolbar.tsx#L701
The idea is to compute the widths only when the zoom change, but the only way I found to know if the zoom has changed is by using the ratio between the window.outerWidth and window.innerWidth https://github.com/jupyterlab/jupyterlab/blob/634cc3a8ccedf5ea79987f5bf9faa0bede83935f/packages/ui-components/src/components/toolbar.tsx#L517.
But this ratio also changes when using the dev tools.

@jtpio
Copy link
Member Author

jtpio commented Apr 2, 2024

I can't reproduce it locally

It was found while testing #7301 on Binder with Firefox 124.

@brichet
Copy link
Contributor

brichet commented Apr 2, 2024

Thanks for the link, I was about to open an issue about notebook width 😄

It also happens with the sidebar, so it is not related to the computation of the item widths.

@brichet
Copy link
Contributor

brichet commented Apr 2, 2024

It seems that only the widgets on the right of the toolbar are affected.
Wondering if they are supposed to be there, and if this is not related to the issue.

@jtpio
Copy link
Member Author

jtpio commented Apr 2, 2024

I think these items come from this extension: https://github.com/manics/jupyter-offlinenotebook

Last time I checked they were added via the toolbar API directly, and not using the settings system (which could be the reason?)

@jtpio
Copy link
Member Author

jtpio commented Apr 3, 2024

#7128 might be related.

@brichet
Copy link
Contributor

brichet commented Apr 3, 2024

Yes, it might be related, if the flickering is due to some kind of floating position of items.
I can reproduce the wrong positions with the first release of Notebook 7, 7.0.0, but it didn't flicker.

@brichet
Copy link
Contributor

brichet commented Apr 4, 2024

The flickering is due to (1) the wrong position of the items because of order insertion (see #7128 (comment)) and (2) the storage of the expected position in a map instead of the real position after insertion here.

The second problem should be easy to fix in Jupyterlab, I'll open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants