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

Make status bar accessible at 400% zoom by hiding items with priority of zero (default) #14854

Merged
merged 57 commits into from
Dec 20, 2023

Conversation

j264415
Copy link
Contributor

@j264415 j264415 commented Jul 19, 2023

References

Code changes

  • new priority argument is added to IStatusBar.IRankItem, which defaults to 0
  • when window is narrow (less or equal to 630 pixels, which is a heuristic for 400% zoom) the items with priority of zero get hidden so that the higher priority items remain visible

User-facing changes

Currently with 400% zoom at 1280px the status bar elements overlap each other which hinders usability. Unrequired elements have been removed and the remaining elements no longer overlap at 320px apparent width (1280px/400%).

This means that when a window is below 320px apparent width, the kernel title, document name and the processor icons will be hidden from view to allow space for the simple switch and the line-column number to be fully visible and accessible. If future text elements are added these will also be hidden unless they are given the priority-zoom class.

Backwards-incompatible changes

Extensions which add custom status bar items may want to set custom priority greater than one if these need to be visible at narrow screens.

@jupyterlab-probot
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 pkg:codeeditor pkg:statusbar tag:CSS For general CSS related issues and pecadilloes Design System CSS labels Jul 19, 2023
@j264415 j264415 marked this pull request as ready for review July 19, 2023 15:33
@t03857785 t03857785 mentioned this pull request Jul 21, 2023
@j264415
Copy link
Contributor Author

j264415 commented Aug 2, 2023

Please could this PR be reviewed. @krassowski

@j264415
Copy link
Contributor Author

j264415 commented Aug 24, 2023

Please could this PR be reviewed. @gabalafou

Copy link
Contributor

@gabalafou gabalafou left a comment

Choose a reason for hiding this comment

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

While I think this PR has some great ideas, it also makes me uncomfortable because I feel like it's trying to achieve at the CSS level what should be achieved at the app/JS level.

For example, the StatusBar class provides a registerStatusItem method. This method is used by extensions, including built-in extensions, to add items to the status bar, like so:

// Add the status item to the status bar.
statusBar.registerStatusItem(lineColItem.id, {
  item,
  align: 'right',
  rank: 2,
  isActive: () => !!item.model.editor
});

It seems to me that this is the point at which something like your "priority-zoom" property should be passed.

I also question some of the decisions about what is and isn't priority in this PR. To me the notification icon is a better use of space than the simple-mode toggle—both because the toggle takes up a lot of space and also because the same command can be accessed in two other ways, via the menu and via the command palette; also there are other more obvious cues about when the app is in simple mode or the not, so I'm not sure how much value is added by always showing that state in the status bar.

I also question how effective this approach is because, for example, here's a screenshot on my laptop with the UI zoomed to 400% and it shows that the changes in this PR have done nothing to help because my laptop screen at 400% does not trigger the at-media rule:



I agree that the status bar is too cluttered at narrow width and/or high zoom. But I'm not sure this is the way to solve it. Or maybe this is the right direction, maybe the items in the status bar need to indicate some priority-level, and then if the status bar doesn't have enough width for all of the items, it starts to remove the lower-priority ones. But I think that functionality probably needs to implemented at the level of the StatusBar TypeScript class.

packages/statusbar/style/base.css Outdated Show resolved Hide resolved
packages/statusbar/style/base.css Outdated Show resolved Hide resolved
@j264415
Copy link
Contributor Author

j264415 commented Aug 31, 2023

Hi @gabalafou looking at the comment you made above about implementing the changes that you want for the 400% zoom through the app/JS level and not CSS; I have made the relevant code changes required to achieve this.
Please could you review these changes.
Thank you

@j264415 j264415 requested a review from gabalafou August 31, 2023 15:57
@j264415
Copy link
Contributor Author

j264415 commented Sep 1, 2023

please update galata snapshot

@j264415
Copy link
Contributor Author

j264415 commented Sep 1, 2023

please update documentation snapshots

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Documentation snapshots updated.

@j264415
Copy link
Contributor Author

j264415 commented Sep 14, 2023

Hi @gabalafou could you please review the changes I have made from your feedback.
Thank you.

private _isWindowZoomed = () => {
// Check is the window width is less than or equal to 630px as this is when the staus bar become unaccessible to the user.
// Works across all screen resolution.
return window.innerWidth <= 630;
Copy link
Member

@krassowski krassowski Dec 14, 2023

Choose a reason for hiding this comment

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

Question from @gabalafou on the call: is there a justification for this specific number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This number is because this is when the status bar starts to become inaccessible. The comment above has been reviewed by @gabalafou and changed to make the reasoning of this number clearer.

@krassowski krassowski added this to the 4.1.0 milestone Dec 14, 2023
Copy link
Contributor

@gabalafou gabalafou 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! I added just a few suggestions to reflect the last changes in the comments and method names

j264415 and others added 4 commits December 15, 2023 09:31
Co-authored-by: gabalafou <gabriel@fouasnon.com>
Co-authored-by: gabalafou <gabriel@fouasnon.com>
Co-authored-by: gabalafou <gabriel@fouasnon.com>
@j264415
Copy link
Contributor Author

j264415 commented Dec 15, 2023

Thank you for working on this! I added just a few suggestions to reflect the last changes in the comments and method names

Thank you for reviewing this !

@gabalafou
Copy link
Contributor

gabalafou commented Dec 15, 2023

This looks good to go from my perspective. The only check failing is UI Tests / Visual Regression, which may be unrelated to this PR.

If there are no objections, I will merge it in on Monday, December 18.

@krassowski
Copy link
Member

This looks good to go from my perspective.

Can you approve it? It seems there is still a an "X" from you. I often sort by approved when merging things before release.

image

The only check failing is UI Tests / Visual Regression, which may be unrelated to this PR.

I think they are unrelated, but I kicked it

If there are no objections, I will merge it in on Monday, December 18.

I might merge it earlier to fit it in beta.0.

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 @j264415!

@krassowski krassowski changed the title Made Status bar accessible at 400% zoom Make status bar accessible at 400% zoom by hiding items with priority of zero (default) Dec 20, 2023
@krassowski krassowski merged commit 9956d5c into jupyterlab:main Dec 20, 2023
79 checks passed
@krassowski
Copy link
Member

@j264415 I updated the top-level comment's Code Changes and Backwards-incompatible changes sections. Please take note for future PRs that we need to keep them aligned with the content of the PR and they can be brief, as long as the key take-away messages are conveyed :)

@j264415 can you please follow with another pull request adding a note to extension migration guide about the new priority attribute and what it entails for extension developers (see my note in Backwards-incompatible changes section, feel welcome to expand on this with an example).

@j264415
Copy link
Contributor Author

j264415 commented Dec 21, 2023

@j264415 can you please follow with another pull request adding a note to extension migration guide about the new priority attribute and what it entails for extension developers (see my note in Backwards-incompatible changes section, feel welcome to expand on this with an example).

@krassowski All done. This is the PR: #15556

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.

Status bar at 400% zoom
4 participants