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

Dark High Contrast Theme for JupyterLab with Improved Sidebar Focus Indication #15623

Merged
merged 26 commits into from
Apr 4, 2024

Conversation

m158261
Copy link
Contributor

@m158261 m158261 commented Jan 9, 2024

References

#9399 - although not a direct colorblindness issue, this PR will improve accessibility for people who need higher contrast than the current dark theme provides. Text in the application now complies with WCAG AAA for contrast.

Also included in this PR is better focus indication for users that navigate using the keyboard. This has been improved for the sidebars and accordion panels.

Code changes

Many of the current CSS variables have been changed to meet WCAG AAA for text in all areas of the application.

Focus-visible selectors have been added to improve focus indication on sidebars for users who use keyboard navigation.

One area for improvement would be higher contrast scrollbars. I could not find how to change the colour of the scrollbar thumb. Any input would be much appreciated.

User-facing changes

A new theme will be added to JupyterLab to improve accessibility for people with visual impairments. Focus indication has also been improved for sidebar widgets by adding a border when elements are focus-visible.

New Dark High Contrast Theme

main page

Code colours now meet AAA for contrast

text in cell

breakpoints

Menu Option for Theme

menu

Advanced settings editor

advanced settings editor

Improved focus indication for sidebar widgets and accordion panels when using keyboard navigation

focus indication

focus indication sidebar

Backwards-incompatible changes

None

Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@m158261 m158261 marked this pull request as ready for review January 9, 2024 17:27
@m158261
Copy link
Contributor Author

m158261 commented Jan 10, 2024

Please update galata snapshots

@m158261
Copy link
Contributor Author

m158261 commented Jan 11, 2024

Please update galata snapshots

@m158261
Copy link
Contributor Author

m158261 commented Jan 19, 2024

Please update galata snapshots

Copy link
Contributor

Galata snapshots updated.

@m158261 m158261 marked this pull request as draft January 23, 2024 15:56
@m158261 m158261 marked this pull request as ready for review January 23, 2024 17:08
@krassowski krassowski added this to the 4.2.0 milestone Feb 21, 2024
@krassowski
Copy link
Member

Note: we should investigate if the theme should be able to turn xterm.js minimumContrastRatio.

@gabalafou
Copy link
Contributor

gabalafou commented Mar 21, 2024

Just putting this down so we have it in writing.

The proposal is to put this in alpha (or release candidate) to gather user feedback before a more general release.

@gabalafou
Copy link
Contributor

Note: we should investigate if the theme should be able to turn xterm.js minimumContrastRatio.

@krassowski could you elaborate on this comment?

@krassowski
Copy link
Member

krassowski commented Mar 21, 2024

xterm.js has minimumContrastRatio setting; it should be enabled in the high contrast theme to make xterm.js use high contrast mode (this is what VSCode does). This does not need to be done in this PR but it would be a nice addition (the alternative is to open a new issue to track it).

Because the docs link is useless (does not include the docstring), here is the reference:

    /**
     * The minimum contrast ratio for text in the terminal, setting this will
     * change the foreground color dynamically depending on whether the contrast
     * ratio is met. Example values:
     *
     * - 1: The default, do nothing.
     * - 4.5: Minimum for WCAG AA compliance.
     * - 7: Minimum for WCAG AAA compliance.
     * - 21: White on black or black on white.
     */
    minimumContrastRatio?: number;

@m158261
Copy link
Contributor Author

m158261 commented Mar 28, 2024

I am unable to continue working on this PR after March 28, 2024. If further refinements are identified, I welcome any future contributors to pick up and progress the work.

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.

Improved focus indication for sidebar widgets and accordion panels when using keyboard navigation

This focus indicator is very hard to read. I would use a different colour (white? very bright blue?).

That said, it is a new, accessible theme, which is an improvement over having none. I would say let's merge and iterate. If we are not happy with including it in the 4.2.0 release do to unpolished quality we can disable this plugin by default and flag as experimental option.

Comment on lines +19 to +25
/**
* Set JupyterLab theme to Dark High Contrast
*/
async setDarkHighContrastTheme(): Promise<void> {
await this.setTheme('JupyterLab Dark High Contrast');
}

Copy link
Member

Choose a reason for hiding this comment

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

Do we really need this? What do folks think?

@jtpio
Copy link
Member

jtpio commented Apr 3, 2024

That said, it is a new, accessible theme, which is an improvement over having none. I would say let's merge and iterate. If we are not happy with including it in the 4.2.0 release do to unpolished quality we can disable this plugin by default and flag as experimental option.

Having it in 4.2.0 sounds good. Also it should technically be just a new entry in the theme menu and the command palette, so it's not too much in the way for those who don't want to use it.

@krassowski krassowski merged commit 78c6f80 into jupyterlab:main Apr 4, 2024
81 checks passed
@krassowski krassowski mentioned this pull request Apr 4, 2024
9 tasks
gderocher pushed a commit to gderocher/jupyterlab that referenced this pull request Apr 26, 2024
…ndication (jupyterlab#15623)

* Added a high contrast dark theme

* Updated variables to improve contrast and improved focus indication on sidebars

* Added a test for toggling high contrast theme

* Changed theme name

* Updated versions in package.json

* Update Playwright Snapshots

* Update version numbers in package.json

* Updated snapshots

* Update package.json

* Update package.json

* Update package.json

* Update package.json - missed quotation marks

* Update package.json version numbers

* Update package.json

* Made naming more consistent

* Updated naming in test helpers

* Update package.json

* Update package.json

---------

Co-authored-by: EC2 Default User <m158261@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants