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

Removed debug switch, added bug button state update #10727

Merged
merged 5 commits into from Sep 1, 2021

Conversation

3coins
Copy link
Contributor

@3coins 3coins commented Jul 29, 2021

References

This PR fixes #10680.

Code changes

  • Add ARIA attributes, pressed and enabled states to toolbar button
  • Removed debug switch button from toolbar
  • Moved bug button before the kernel switcher
  • Updated debugger handler to show a new icon for pressed state
  • Updated debugger handler, so show debug button as disabled for kernels with no debugging support
  • Removed build script code that writes icon classes to deprecated.css
  • Updated kernel status toolbar icon styling
  • Added right padding to notebook toolbar to have some visual space for the kernel status icon.

User-facing changes

remove-debug-switch-5

Backwards-incompatible changes

N/A

@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@github-actions github-actions bot added Design System CSS pkg:debugger tag:CSS For general CSS related issues and pecadilloes labels Jul 29, 2021
@blink1073 blink1073 added this to the 4.0 milestone Jul 29, 2021
@ellisonbg
Copy link
Contributor

I like the conceptual idea that the debugger button is related to the other kernel items. At the same time, I think this control might work better to the left of the kernel switcher UI. Historically, the kernel status indicator has been the right-most toolbar icon, and I think it makes sense to preserve that positioning. @3coins can you try it to the left of the kernel switcher?

@3coins 3coins force-pushed the remove-debug-switch branch 2 times, most recently from 29781b2 to 8c94974 Compare July 30, 2021 17:14
Copy link
Contributor

@ellisonbg ellisonbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved from a UX perspective

@3coins
Copy link
Contributor Author

3coins commented Jul 30, 2021

I like the conceptual idea that the debugger button is related to the other kernel items. At the same time, I think this control might work better to the left of the kernel switcher UI. Historically, the kernel status indicator has been the right-most toolbar icon, and I think it makes sense to preserve that positioning. @3coins can you try it to the left of the kernel switcher?

Done, plz take a look.

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

  1. As a partially colorblind person I have to object to the current implementation as it is not accessible. We need a different icon for the active state, distinguished by more than color as proposed in Remove debug buttons in toolbar #10680 (comment). I don't care if it gets the run triangle icon "|>" added, is upside down, rotated or anything else - but it has to differ. Let's not introduce new accessibility issues :). Please let me know iff you need help with creating a new icon.
  2. Would it be a good idea to make the tooltip ("'Enable / Disable Debugger'") state-specific, this is show either "Enable Debugger" or "Disable Debugger" depending on the state?
  3. There is also a regression for screen readers (aria state which was conveyed by Switch toggle got removed without an alternative added).

packages/debugger/src/handler.ts Outdated Show resolved Hide resolved
@fcollonval
Copy link
Member

Thanks a lot for this one @3coins

I wonder if it could be better to always display the icon (with a status disabled if the kernel does not support debugger). The delay to display the debug icon when switching kernels feels awkward; see animation below. What do you think @ellisonbg ?

Peek 2021-08-04 12-05

@3coins
Copy link
Contributor Author

3coins commented Aug 4, 2021

Thanks a lot for this one @3coins

I wonder if it could be better to always display the icon (with a status disabled if the kernel does not support debugger). The delay to display the debug icon when switching kernels feels awkward; see animation below. What do you think @ellisonbg ?

Peek 2021-08-04 12-05

Thanks for that suggestion. I agree that it is clunky the way debug button is added into the page. @ellisonbg, let me know what you think having a disabled button there from UX perspective.

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @3coins

I left some comments. Could you also address those two generic points:

  • methods should be documented (short sentence on what they are doing and what are their arguments and returned value)
  • please type the return value of functions
  • please type the private variables

buildutils/src/ensure-package.ts Outdated Show resolved Hide resolved
buildutils/src/ensure-package.ts Outdated Show resolved Hide resolved
const trans = translator.load('jupyterlab');
const icon = new ToolbarButton({
className: 'jp-DebuggerBugButton',
icon: bugIcon,
tooltip: trans.__('Enable / Disable Debugger'),
tooltip: trans.__('Enable Debugger'),
ariaLabel: trans.__('Enable/Disable Debugger'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3coins I will drop the aria-label as the title has the same content and is changing depending on the button state (on the opposite of the aria-label)

Comment on lines +10 to +13
:root {
--jp-notebook-toolbar-padding: 2px 5px 2px 2px;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -607,10 +625,57 @@ export class ToolbarButton extends ReactWidget {
constructor(private props: ToolbarButtonComponent.IProps = {}) {
super();
addToolbarButtonClass(this);
this._enabled = props.enabled ?? true;
this._pressed = this._enabled === true ? props.pressed ?? false : false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small simplification

Suggested change
this._pressed = this._enabled === true ? props.pressed ?? false : false;
this._pressed = this._enabled && props.pressed;

Comment on lines 633 to 650
set pressed(value: boolean) {
if (value != this._pressed) {
this._pressed = value;
this.update();
}
}

get pressed() {
return this._enabled === true ? this._pressed : false;
}

set enabled(value: boolean) {
if (value != this._enabled) {
this._enabled = value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should enforce in setter that pressed cannot be set if the button is disabled. So the getter should point to the private value only (otherwise in further use, this._pressed could be different that this.pressed).

Suggested change
set pressed(value: boolean) {
if (value != this._pressed) {
this._pressed = value;
this.update();
}
}
get pressed() {
return this._enabled === true ? this._pressed : false;
}
set enabled(value: boolean) {
if (value != this._enabled) {
this._enabled = value;
set pressed(value: boolean) {
if (this.enabled && value !== this._pressed) {
this._pressed = value;
this.update();
}
}
get pressed() {
return this._pressed;
}
set enabled(value: boolean) {
if (value !== this._enabled) {
this._enabled = value;
if (!this._enabled) {
this._pressed = false;
}

'ui-components:bug-dot'
);
widget.dispose();
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test to check that disabled button cannot be pressed.

expect(button.getAttribute('aria-disabled')).toEqual('true');
widget.dispose();
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test that disabling a pressed button, unpressed it.

@fcollonval
Copy link
Member

One additional comment I forgot in the review. The new button should be using the new toolbar customization feature.

See for example

Piyush Jain added 5 commits August 24, 2021 12:50
* Removed debug switch
* Moved debug button to left of kernel name
* Added aria attributes, pressed and enabled states to ToolbarButton component
* Disabled debug button when debugging is not supported
@3coins
Copy link
Contributor Author

3coins commented Aug 25, 2021

One additional comment I forgot in the review. The new button should be using the new toolbar customization feature.

See for example

@fcollonval
This requires a lot of changes as the button currently is embedded inside the handler, I will add this change to a separate PR. I have made all the other changes as per your suggestions.

For removing the icon css classes, here is the pull request - #10908

@jtpio
Copy link
Member

jtpio commented Aug 27, 2021

Thanks for working on this, it looks great on Binder!

Is there any remaining items to fix, or could some of the comments above be addressed in separate PRs?

@fcollonval fcollonval self-requested a review August 27, 2021 13:43
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can address my comment in a follow-up PR as suggested by @3coins => follow-up issue created #10939

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jtpio jtpio merged commit 7c5092e into jupyterlab:master Sep 1, 2021
@jtpio
Copy link
Member

jtpio commented Sep 1, 2021

Looks like a follow-up on the UI tests is needed after the merge: https://github.com/jupyterlab/jupyterlab/runs/3482183886

image

@jtpio
Copy link
Member

jtpio commented Sep 1, 2021

Looks like a follow-up on the UI tests is needed after the merge: https://github.com/jupyterlab/jupyterlab/runs/3482183886

Opened #10982

@meeseeksmachine
Copy link
Contributor

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/how-to-toggle-a-toolbar-button-icon/10952/4

@meeseeksmachine
Copy link
Contributor

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/how-to-toggle-a-toolbar-button-icon/10952/5

3coins pushed a commit to 3coins/jupyterlab that referenced this pull request Sep 29, 2021
blink1073 pushed a commit that referenced this pull request Sep 29, 2021
Co-authored-by: Piyush Jain <pijain@amazon.com>
@meeseeksmachine
Copy link
Contributor

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/jupyterlab-ide-customization/11271/6

@krassowski
Copy link
Member

We may have missed the editor toolbar, as per the report in https://discourse.jupyter.org/t/jupyterlab-ide-customization/11271/5. It indeed does not seem possible to debug standalone scripts anymore in 3.2. CC @3coins.

@jtpio
Copy link
Member

jtpio commented Oct 18, 2021

Ah good catch, thanks @krassowski.

Let's open a new issue to track this?

@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Apr 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Design System CSS enhancement pkg:debugger pkg:notebook pkg:ui-components status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. tag:CSS For general CSS related issues and pecadilloes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove debug buttons in toolbar
8 participants