-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Improve resizing behavior of debugger panels #10653
Improve resizing behavior of debugger panels #10653
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
Thanks for this, looking good! |
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.
Great work, thank you. Have you considered using CSS grid instead of doing the size computations manually? See https://github.com/jess-x/jupyterlab/pull/1/files for some inspiration; this is a question and not a request - I am just curious to know if you tried. Also, two minor UX points:
-
Since the header is now a click target, it is now possible for the annoying text-selection-on-click effect to kick-in. I would consider adding
user-select: none;
to the header label to prevent that effect: -
The height limitation only kicks in after resizing. I wonder if it could work during resizing. I imagine it could be more difficult to implement, so absolutely no need to rework it right now, but it would be good to know if you tried addressing that and if you have any thoughts on what would be needed to solve it.
this._paddingDiv.node.style.flexGrow = '1'; | ||
this._paddingDiv.node.style.height = '100%'; |
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.
Can we move this to a CSS file? I think the convention is to create a new class name matching the name of the class, so jp-PanelHeader
and use appropriate selector in CSS styles file.
@krassowski thank you for reviewing my PR. On the other hand, the PR of @fcollonval on lumino (jupyterlab/lumino#205) uses a CSS approach and I think it's a better way to directly use an upstream widget instead of reinventing it in client code. I can update this PR once the AccordionPanel widget is available. |
Looks like jupyterlab/lumino#205 has now been merged and released, so maybe we can update this PR to reuse the upstream widget? |
@jtpio yes i'll do it |
@trungleduc mind doing one more rebase to fix the conflicts? Thanks! |
@jtpio I'll update this PR this week to incorporate |
9533b46
to
b363ca0
Compare
this.addClass('jp-DebuggerBreakpoints'); | ||
} | ||
|
||
get header(): PanelHeader { |
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.
Let's add a docstring for consistency?
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.
I'm working on it, this PR needs 1-2 more commits to be ready for review.
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 @trungleduc
Some early comment on using the AccordionPanel
. Let me know if you want to discuss about that (maybe some interfaces of the AccordionPanel
needs to be adapted).
} | ||
|
||
export namespace DebuggerPanelBody { | ||
export class Renderer extends SplitPanel.Renderer { |
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.
You should inherit from AccordionPanel.Renderer
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.
Resolved is last commits
* @returns A element representing the collapse indicator. | ||
*/ | ||
createCollapseIcon(data: Title<Widget>): HTMLElement { | ||
return document.createElement('span'); |
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.
You should use an SVG icon here. See for example https://github.com/jupyterlab/jupyterlab/blob/master/packages/ui-components/src/icon/widgets/tabbarsvg.ts#L30 for the close icon on tabs
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.
Resolved is last commits
* click. Since the toolbar contains buttons, icons..., we need to check | ||
* the type of `env.target` before activating handler. | ||
*/ | ||
private _handleClick(event: MouseEvent): void { |
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.
I don't get why click event needs to be overridden
handle.id = this.createTitleKey(data); | ||
handle.className = this.titleClassName; | ||
if (header) { | ||
console.log('adding', header.node); |
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.
Reminder to remove it
console.log('adding', header.node); |
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.
Resolved is last commits
header.processMessage(Widget.Msg.BeforeAttach); | ||
handle.appendChild(header.node); | ||
header.processMessage(Widget.Msg.AfterAttach); |
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.
Prefer the Widget
helper:
header.processMessage(Widget.Msg.BeforeAttach); | |
handle.appendChild(header.node); | |
header.processMessage(Widget.Msg.AfterAttach); | |
Widget.attach(header, handle); |
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.
Widget.attach
does not work here since handle
is not yet attached to DOM
const title = new Widget({ node: document.createElement('h2') }); | ||
title.node.textContent = trans.__('Source'); | ||
super(translator); | ||
this.titleWidget.node.textContent = this._trans.__('Source'); |
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.
This should be set on the PanelBody
title: this.title.label = ...
this.titleWidget.node.textContent = this._trans.__('Source'); |
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.
Resolved is last commits
const handle = document.createElement('h3'); | ||
handle.setAttribute('role', 'button'); | ||
handle.setAttribute('tabindex', '0'); | ||
handle.id = this.createTitleKey(data); | ||
handle.className = this.titleClassName; |
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.
It will be better to call the default implementation here first:
const handle = document.createElement('h3'); | |
handle.setAttribute('role', 'button'); | |
handle.setAttribute('tabindex', '0'); | |
handle.id = this.createTitleKey(data); | |
handle.className = this.titleClassName; | |
const handle = super.createSectionTitle(data); |
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.
Resolved is last commits
/** | ||
* The base header for a debugger panels. | ||
*/ | ||
export class PanelHeader extends 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.
You should not use a header widget but add the toolbar to the PanelBody
and use its title
attribute to set the metadata.
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.
Resolved is last commits
37c27df
to
88ad9a9
Compare
Hi folks, It looks like benchmark tests and UI tests are failing for others PRs too, so this PR is ready for review again. |
One more rebase should hopefully pick the latest fixes and make these checks green. |
Shouldn't need a rebase, just a new commit or close/open |
Benchmark reportThe execution time (in milliseconds) are grouped by test file, test type and browser. Results table
❗ Test metadata have changed--- /dev/fd/63 2021-09-15 10:27:23.746670755 +0000
+++ /dev/fd/62 2021-09-15 10:27:23.746670755 +0000
@@ -34,7 +34,7 @@
"voltage": ""
},
"mem": {
- "total": 7291699200
+ "total": 7291695104
},
"osInfo": {
"arch": "x64",
@@ -42,11 +42,11 @@
"codename": "Focal Fossa",
"codepage": "UTF-8",
"distro": "Ubuntu",
- "kernel": "5.8.0-1041-azure",
+ "kernel": "5.8.0-1040-azure",
"logofile": "ubuntu",
"platform": "linux",
"release": "20.04.3 LTS",
- "serial": "faac5b9e00cf4ae3b2d2c013e98d933a",
+ "serial": "0f5fd491ff264b5f9d56e03599b4fae0",
"servicepack": "",
"uefi": false
} |
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 @trungleduc I tested and noticed a couple of styling issues:
- The collapsed title is smaller than the uncollapsed one so the buttons are not contained in the collapsed stated
- Clicking on the icon does not toggle the collapse state
- We should ask at the dev meeting why the
CommandToolbarButton
is not stopping the propagation of the mouse event. It will simplify the code and avoid further problem.
- We should ask at the dev meeting why the
- The icon is not changing with the collapsed state
Test done on FireFox 88
Thanks @fcollonval for testing it. debugger.mp4
I tried to call |
…leduc/jupyterlab into ft/improve-debugger-panels
I push two commits. The first one simplify the code:
The second switch to use We need to wait for a new release of @lumino/widgets to remove code dealing with the |
Thanks @fcollonval. |
References
The panels of debugger sidebar are resizable but since the height of panel is not limited, users can completely overlap one over others.
old.mp4
This PR improves the resizing behavior of these panels to prevent this situation and adds the possibility to click on the header to expand or contract corresponding panel.
Code changes
DebuggerSidebar
in order to recompute height of all panels, this method is called by children panels.User-facing changes
new.mp4
Backwards-incompatible changes
N/A