-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Do not set the dockpanel as parent of the tabbar #606
Conversation
Thanks a lot for digging this one up @brichet I would rather avoid adding a new attribute for this. Looking at the current behavior, when the dock panel creates a split, it adds a tab bar. When that tab bar is attached to the panel, its lumino/packages/widgets/src/docklayout.ts Line 1133 in 07d4bab
That triggers the lumino/packages/widgets/src/widget.ts Line 232 in 07d4bab
The addition of the split handle does not triggered such messages as they are directly attached to the HTML element. This is actually wrong as adding/removing a tab bar should be transparent for dock panels. The message The wrong behavior can also be seen in JupyterLab by the wrongly addition of the class Therefore I think a better fix would be to not set the tab bar parent, simply attaching it as it is done for the handle. cc @afshin @krassowski what do you think?
|
Thanks for the suggestion @fcollonval, I reverted the previous changes and add a commit to avoid setting the parent of the tab bar. |
let w1 = new Widget(); | ||
panel.addWidget(w1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry to drop a comment out of the blue, but I stumbled on this PR while researching something else, and I realized that while trying to read the code in this PR that these two lines in the test function are not self-evident to me. Should they be followed with an assertion?
let w1 = new Widget(); | |
panel.addWidget(w1); | |
let w1 = new Widget(); | |
panel.addWidget(w1); | |
expect(panel.contains(w1)).to.be.true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prior to this modification, the TabBar
was added as a child widget of the DockPanel
, as well as the document panels. The TabBar
was only added if at least one widget had been added to the DockPanel
.
This test adds a widget only to ensure the TabBar
is not added to the child widgets list (which was the case prior to this PR).
In fact I believe it should be simplified, maybe this is what confused you.
let w1 = new Widget(); | |
panel.addWidget(w1); | |
panel.addWidget(new Widget()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TabBar was only added if at least one widget had been added to the DockPanel.
Without knowing these implementation details, somebody reading this test has to guess at the intent of the panel.addWidget()
call. Could you clarify your intent with a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in f0a3d33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @brichet
This PR fixes #604
It adds an attribute to Widget to disable the tracking fromfocusTracker
, event if its elements can get the focus.By default all the widgets are trackable, except for theTabBar
.It avoids setting the parent of the tab bar in the dock panel.