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

Added fullscreen feature with command alt f #16308

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

dhysdrn
Copy link

@dhysdrn dhysdrn commented May 8, 2024

References:

Fixes #8710 - Add fullscreen option to JupyterLab
Adding the base fullscreen mode functionality in preparation for fullscreen mode expansion to allow individual widgets to enter fullscreen mode for presentation purposes per the requests in PR #10676.

Code Changes:

jupyterlab/packages/application-extension/src/index.tsx
Added Lines 113-114 - Export the toggleFullscreenMode component.
Added Lines 438-454 - The toggleFullscreenMode command component
Added Line 544 - Register the new command as a CommandIDs entry in the palette
jupyterlab/packages/application-extension/schema/commands.json
Added Lines 293-296 - Include keyboard shortcut of Alt + F
Added Lines 50-54 - Include the fullscreen option in the top bar menu
jupyterlab/packages/application/shell.d.ts
Added Lines 282-287 Created the entry to get/set the fullscreenMode css value to the shell div (preparation for individual fullscreen widgets)

User-Facing Changes:

Provides a menu option to enter fullscreen mode and uses Alt + F as the shortcut key to toggle into and out of fullscreen mode.
no-fullscreen-menu
fullscreen-menu

F11 remains disabled as a means to enter fullscreen mode to maintain current production JupyterLab behavior.

If entering fullscreen using the Alt + F shortcut or button in the view > Fullscreen Mode menu, users can exit with the view > Fullscreen Mode menu option, Alt + F, ESC key, or F11 key, and JupyterLab maintains fullscreen synchronization of the menu item, check box, and CSS styling.
fullscreen-menu-checked

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

Copy link

welcome bot commented May 8, 2024

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@Rob-P-Smith
Copy link
Contributor

Rob-P-Smith commented May 8, 2024

@meeseeksdev tag enhancement

bot please update snapshots

Copy link
Contributor

github-actions bot commented May 8, 2024

Documentation snapshots updated.

Copy link
Contributor

github-actions bot commented May 8, 2024

Galata snapshots updated.

@krassowski krassowski added this to the 4.3.0 milestone May 9, 2024
@Rob-P-Smith
Copy link
Contributor

@krassowski We've adjusted the code to align more with the existing codebase and cleaned up the uncaught error issue that previously failed "jplm run eslint:typed".

If this is acceptable, we'd like to close this and work on full-screening individual elements as a separate issue next, e.g. terminal/notebook/widgets etc as requested in the previous PR that attempted to solve issue #8710 here:
#10676

bot please update snapshots

Copy link
Contributor

Documentation snapshots updated.

Copy link
Contributor

Galata snapshots updated.

@krassowski
Copy link
Member

Just as FYI, you do not need to write down the code changes by file and line range in the PR description (these these quickly get outdated). What I would recommend is to focus on listing major API changes if there are any, e.g. that fullScreenMode was added to LabShell.

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.

I do not have a strong opinion on this, but I think it is fine to start with.
Before this can be merged here is a few suggestions.

packages/application-extension/src/index.tsx Outdated Show resolved Hide resolved
/**
* Toggle the fullscreen mode based on user inputs
*/
setFullscreenMode(): void {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this method? Could it be handled in the setter of fullscreenMode property instead to minimize the API surface?

* `jp-mod-fullscreenMode` CSS class.
*/
get fullscreenMode(): boolean {
return this.hasClass('jp-mod-fullscreenMode');
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should store state which can be modified by the JS API by using a CSS class - this can lead to inconsistent state if an extension or JS in outputs of user executed code manipulate the fullscreen state (for example rise extension for presenting slides could do that).

I would prefer if the getter returned the state derived from the browser API like fullscreenElement. That said, I am not even sure if we need a getter/setter here - if we are not setting the CSS class, then we could get away without extending the public API of LabShell at all, which will make merging this PR much easier.

Copy link
Author

Choose a reason for hiding this comment

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

We made the changes and removed the getter/setter and directly queried the fullscreenElement value, we also reverted toggle sidebar widget to its original code. Thank you! (:

@dhysdrn
Copy link
Author

dhysdrn commented May 20, 2024

@krassowski it looks like we're failing some tests and unsure what we need to do to fix it, could you help us with this?

@krassowski
Copy link
Member

Some of the failing tests are just flaky, I can restart these. One screenshot test appears to need updating:

[jupyterlab] › test/jupyterlab/menus.test.ts:30:9 › General Tests › Open menu item View>Appearance

bot please update galata snapshots (we may need to revert some spurious updates afterwards)

Copy link
Contributor

Galata snapshots updated.

@dhysdrn
Copy link
Author

dhysdrn commented May 26, 2024

bot please update galata snapshots

Copy link
Contributor

Documentation snapshots updated.

Copy link
Contributor

Galata snapshots updated.

@dhysdrn
Copy link
Author

dhysdrn commented May 27, 2024

@krassowski i think we made all the right changes, could you help us with this?

/**
* Toggle the fullscreen mode based on user inputs
*/
toggleFullscreenMode(): void {
Copy link
Member

Choose a reason for hiding this comment

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

Can I ask for one more thing - to move this method into a function in packages/application-extension/src/index.tsx?

The rationale is a follows: once we add something to LabShell class , any attempt to change it will be potentially breaking for an extension. Since there is further expansion of the fullscreen capabilities requested (to cover making individual elements take the full screen) enhancements, I think it is likely that the implementation may change.

Copy link
Author

Choose a reason for hiding this comment

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

@krassowski we’ve removed the method and added it to packages/application-extension/src/index.tsx, let us know if it looks good

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.

Add full screen option to JupyterLab
3 participants