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(theme-classic): fix docs sidebar layout shifts when expanding categories #7134

Merged
merged 2 commits into from
Apr 8, 2022

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Apr 8, 2022

Motivation

Fix #5254

scrollbar-gutter property support has significantly increased since last time we checked: https://caniuse.com/mdn-css_properties_scrollbar-gutter

Even if support is not perfect, it can already be used as a progressive enhancement thanks to @supports mediaquery

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

preview layout shifts are fixed in all browsers supporting scrollbar-gutter

other browsers (Safari) should keep working the same


Other related issue: #7130

Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Shall we fix this in Infima instead?

@slorber
Copy link
Collaborator Author

slorber commented Apr 8, 2022

Shall we fix this in Infima instead?

I don't think so, Infima's responsibility is to define the design for collapsible category items, not assume in which kind of container/parent they will be used and what padding should be applied in a given context (the current padding was already defined in Docusaurus btw).

@netlify
Copy link

netlify bot commented Apr 8, 2022

[V2]

Name Link
🔨 Latest commit e497af8
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6250099301a18d00087c30d7
😎 Deploy Preview https://deploy-preview-7134--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Apr 8, 2022

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 59
🟢 Accessibility 100
🟢 Best practices 92
🟢 SEO 100
🟢 PWA 90

Lighthouse ran on https://deploy-preview-7134--docusaurus-2.netlify.app/

@github-actions
Copy link

github-actions bot commented Apr 8, 2022

Size Change: +100 B (0%)

Total Size: 806 kB

Filename Size Change
website/build/assets/css/styles.********.css 105 kB +100 B (0%)
ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 49.9 kB
website/build/assets/js/main.********.js 612 kB
website/build/index.html 38.6 kB

compressed-size-action

@Josh-Cena
Copy link
Collaborator

I was mainly pointing to things like thin-scrollbar. Maybe we should have another utility class for scrollbar-gutter: stable;. But this looks fine as well.

Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

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

Very cool!

@Josh-Cena Josh-Cena changed the title fix(docs): fix docs sidebar layout shifts when expanding categories fix(theme-classic): fix docs sidebar layout shifts when expanding categories Apr 8, 2022
@Josh-Cena Josh-Cena added the pr: polish This PR adds a very minor behavior improvement that users will enjoy. label Apr 8, 2022
@slorber
Copy link
Collaborator Author

slorber commented Apr 8, 2022

I was mainly pointing to things like thin-scrollbar. Maybe we should have another utility class for scrollbar-gutter: stable;. But this looks fine as well.

I don't know, there are other values like stable both-edges that can be useful in certain contexts. For now, it's probably preferable to keep this here and see if there's value creating an utility class later

@slorber
Copy link
Collaborator Author

slorber commented Apr 8, 2022

Seems to be working fine in Chrome, Edge, Firefox.

Safari remains the last major desktop browser not supporting this, but they have been implementing a lot of new cool things recently so I'm optimist to see this supported soon

@slorber slorber merged commit 3e11005 into main Apr 8, 2022
@slorber slorber deleted the slorber/scrollbar-gutter-sidebar branch April 8, 2022 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: polish This PR adds a very minor behavior improvement that users will enjoy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout shift when in docs sidebar when scroll bar appears
3 participants