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 visible scrollbar in SideNav when collapsed #1786

Merged
merged 3 commits into from Nov 9, 2023
Merged

Conversation

alex-ju
Copy link
Member

@alex-ju alex-ju commented Nov 8, 2023

πŸ“Œ Summary

Fix visible scrollbar in SideNav when collapsed and the scroll bar is set to be always visible.

πŸ› οΈ Detailed description

When set to be always visible at the OS level or an external mouse or trackpad is used, the scroll bars are always displayed. This is aesthetically unpleasant so we prevent this scroll from being visible by hiding the hds-side-nav__content when the SideBar is minimized. This change was tested locally in cloud-ui and atlas.

Note: the demo app commit was added to ease the review, the commit will be removed before merging.

πŸ“Έ Screenshots

In demo app, with scrollbar set to always be visible

BeforeAfter
Screenshot 2023-11-08 at 16 50 07 Screenshot 2023-11-08 at 16 49 28

In cloud-ui with slowed down animation and scrollbar set to always be visible

BeforeAfter
sidenav-scroll-before.mp4
sidenav-scroll-after.mp4

πŸ”— External links

Jira ticket: HDS-2853
Slack thread


πŸ‘€ Component checklist

  • Percy was checked for any visual regression
  • A11y tests have been run locally (yarn test:a11y --filter="COMPONENT-NAME")
  • If documenting a new component, an acceptance test that includes the a11yAudit has been added
  • A changelog entry was added via Changesets if needed (see templates here)

πŸ’¬ Please consider using conventional comments when reviewing this PR.

Copy link

vercel bot commented Nov 8, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
hds-showcase βœ… Ready (Inspect) Visit Preview Nov 9, 2023 4:35pm
hds-website βœ… Ready (Inspect) Visit Preview Nov 9, 2023 4:35pm

@alex-ju alex-ju requested a review from a team November 8, 2023 17:00
@alex-ju alex-ju marked this pull request as draft November 8, 2023 17:37
Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

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

OK for me.

One thing I noticed is that in the demo app the scroll bar doesn't jump when re-opening the sidenav (from minimized to expanded) while in the video recording attached to the PR description, in Cloud UI, it jumps (vertically, it seems the content is resized while expanding). Something we should be worried about?

"@hashicorp/design-system-components": patch
---

`SideNav` - Fixed visible scrollbar in collapsed SideNav when scroll bar is set to be always visible
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ‘

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure thing – added in 4a4a3e3

@@ -16,6 +16,11 @@
// we use this trick (increasing the container size here, and reducing it at single panel level)
// to have the panels width match the sidebar extended width (it's used in the animated sliding of the panels)
margin: 0 calc(var(--token-side-nav-wrapper-padding-horizontal) * -1);

.hds-side-nav--is-minimized & {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a comment here, explaining what is going on and why we need this "hack"

@alex-ju
Copy link
Member Author

alex-ju commented Nov 9, 2023

One thing I noticed is that in the demo app the scroll bar doesn't jump when re-opening the sidenav (from minimized to expanded) while in the video recording attached to the PR description, in Cloud UI, it jumps (vertically, it seems the content is resized while expanding). Something we should be worried about?

It can happen in the demo app as well, it's related to the size of content in hds-side-nav__content and the height of the window (in my capture it was very low in height as I had the web developer tools open). I will further look into it, but don't want to block TFCs adoption.

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