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

dropdown sometimes shows up leftmost in the toolbar #7

Open
parmentelat opened this issue Dec 1, 2023 · 6 comments
Open

dropdown sometimes shows up leftmost in the toolbar #7

parmentelat opened this issue Dec 1, 2023 · 6 comments

Comments

@parmentelat
Copy link
Owner

observed on rare occasions, mostly with multiple notebooks open

the symptom is the dropdown button <-> does get created but it show up at the left end of the toolbar,
before the diskette icon

any clue as to how to reproduce reliably would be helpful

@firezym
Copy link
Contributor

firezym commented Dec 1, 2023

@parmentelat Sure, I will pay attention to it.
I think probably it is about this line of code: notebookPanel.toolbar.insertItem(10, 'cellWidth', button)
The first param is the order of this widget. But I am not sure how official button is the toolbar button's orders are organized. If I place index as 11 or bigger, the button will appear at the right side before the debug button. It is not very intuitive for me to under stand the order index as number.

@firezym
Copy link
Contributor

firezym commented Dec 1, 2023

Do you notice that debug button also jumps around when switching and refreshing between 2 different notebooks?
image
image
image

@firezym
Copy link
Contributor

firezym commented Dec 1, 2023

I can not now reproducing my dropdown button <-> 's jumping around left or right. But my debug button is behaving what you said in this issue lol...

@parmentelat
Copy link
Owner Author

I think probably it is about this line of code: notebookPanel.toolbar.insertItem(10, 'cellWidth', button)

my understanding is the toolbar is defined here:
https://github.com/jupyterlab/jupyterlab/blob/main/packages/notebook-extension/schema/panel.json#L4-L37

I believe that inserting with a rank (in our case 50 sounds about right) would ensure a correct placement, but I can't seem to find an API call that accepts a rank; there is insertAfter however, that maybe could help out
https://jupyterlab.readthedocs.io/en/latest/api/classes/ui_components.Toolbar-1.html#insertAfter

another totally different option would be to define the whole button/submenu in our plugin.json rather than in code, it seems more in line with what current practices are tending towards, but I am not exactly 100% comfy with that yet :)


just to understand where we are now, is version 0.2.1 workable for daily work for you ?

also please make sure to mention which version you are using when you post an observation, esp. when things change as fast as they these days ;-)

@firezym
Copy link
Contributor

firezym commented Dec 1, 2023

@parmentelat Sure, I will mention the version or sync the codes before test :)
The version 0.2.1 is working well for my daily work now :)
I learned a lot from your code changes :) Thanks a lot!

@firezym
Copy link
Contributor

firezym commented Dec 10, 2023

I submitted an issue in the jupyterlab official repo about the button order. There is improvement in 4.1.0a3, but still slight chance of disorder...

jupyterlab/jupyterlab#15509

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

No branches or pull requests

2 participants