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

fix(sidebar): fix scrolling behavior #8512

Merged
merged 2 commits into from
Mar 27, 2023
Merged

Conversation

fiji-flo
Copy link
Contributor

@fiji-flo fiji-flo commented Mar 27, 2023

Summary

Fixes #8494

Problem

Several issues.

  • On a view port 1400x700 overflow was shown for the left sidebar and it wasn't scroll-able.
  • Unnecessary scroll bars were shown on the right sidebar (ToC).

Solution

Set overflow correct.


Screenshots

Before

image

After

image

@fiji-flo fiji-flo requested a review from caugner March 27, 2023 13:29
Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

I can imagine the intention of those changes, but it would be good if the commit message would list the different changes and what they do / why they are necessary:

  1. You pull the CSS variables up.
  2. You restrict the overflow: auto to screens with low height.
  3. You change the .toc-container from overflow: scroll to overflow: auto.
  4. You change the .sidebar-inner from Flexbox to Grid for low height, and Flexbox for sufficient height.
  5. You change the .sidebar-inner-nav to display: contents for low height, and block for sufficient height.
  6. You introduce a $screen-height-limit to distinguish low and sufficient height.

@@ -247,6 +247,8 @@ $screen-lg: 992px;
$screen-xl: 1200px;
$screen-xxl: 1441px;

$screen-height-limit: 44rem;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment for what this is? Or maybe you find a more descriptive name?

Comment on lines 236 to 237
@media screen and (min-height: $screen-height-limit),
screen and (min-width: $screen-lg) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency, can we put the min-width condition first? If stylelint auto-fixes this, let's move the min-height condition to an inner block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did get the last part? Move to what inner block?

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically the idea was either:

@media screen and (min-width: $screen-lg), screen and (min-height: $screen-height-limit) {
 /* ... */
}

Or (if the order was forced by stylelint):

@media screen and (min-width: $screen-lg) {
  @media screen and (min-height: $screen-height-limit) {
   /* ... */
  }
}

client/src/document/index.scss Outdated Show resolved Hide resolved
client/src/document/index.scss Show resolved Hide resolved
@media screen and (max-width: $screen-lg) {
.mdn-cta-container ~ .document-page & {
--offset: calc(var(--main-document-header-height) + 3rem);
--max-height: calc(100vh - var(--offset));
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I don't think we need to override --max-height, do we?

- .sidebar-inner is a grid when < screen-md
  - this allows to use display: contents on .sidebar-inner-nav
    and more the .place up via grid-row: 2/3
- screen-height-place-limit introduced to have central place for it
- on screens > screen-md and height < screen-height-place-limit:
  use .use display flex on .sidebar-inner and block on sidebar-inner
  nav to revert the gird again
- .toc-container: overflow: auto to remove scroll bars
@caugner caugner changed the title fix(sidebar): fix scrolling behavior. fix(sidebar): fix scrolling behavior Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Left Navigation Bar not Works Properly
2 participants