Skip to content

Conversation

@Deepak-cell311
Copy link

@Deepak-cell311 Deepak-cell311 commented May 16, 2025

screen

Closes #262

@Deepak-cell311
Copy link
Author

Hi @Swiftb0y
Kindly have a look over and review this PR whenever you have a moment.
Thank you🚀

Copy link
Member

@acolombier acolombier left a comment

Choose a reason for hiding this comment

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

Hi @Deepak-cell311, thanks for your contribution!

Could you clarify what does your change? I can see it has extended to menu drawer to fill the window, is there something else this is intending to fix?

(Before/after video)

Screencast.From.2025-05-16.09-18-10.mp4

--button-primary-color: white;
}


Copy link
Member

Choose a reason for hiding this comment

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

nit: unnecessary change

Suggested change

border-bottom: 1px solid var(--border-color-softer);
padding: 2rem;
max-height: unset;

Copy link
Member

Choose a reason for hiding this comment

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

nit: unnecessary change

Suggested change

Comment on lines 431 to 432
/* height: 100vh; */

Copy link
Member

Choose a reason for hiding this comment

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

nit: comment cruft

Suggested change
/* height: 100vh; */

Comment on lines 757 to 759



Copy link
Member

Choose a reason for hiding this comment

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

nit: unnecessary spaces

Suggested change

Comment on lines 70 to 78
const navToggle = document.getElementById('navbar-hamburger-button');

navToggle.addEventListener('change', () => {
if (navToggle.checked) {
document.body.classList.add('scroll-lock');
} else {
document.body.classList.remove('scroll-lock');
}
});
Copy link
Member

Choose a reason for hiding this comment

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

#navbar-hamburger-button is a hidden element used to persist the expected state of the menu AFAIU, so that scroll-lock won't have any effect.

@Deepak-cell311
Copy link
Author

Hi @acolombier,

Thank you for the review and helpful feedback.

In my previous implementation, I used the hidden checkbox input (#navbar-hamburger-button) to detect when the mobile menu was toggled and then added a scroll-lock class on the to prevent the background from scrolling.

However, as you rightly pointed out, since the input is visually hidden and used only to preserve state, it doesn’t reliably control page scrolling across all browsers and screen readers. As a result, the page behind the open menu remained scrollable in some environments, which wasn’t the expected behavior. It only works on my local machine.

In my current approach, I've updated the structure to wrap the entire page content inside a #page-wrapper element. When the mobile menu is opened, the scroll-lock class is now applied to #page-wrapper instead of body. This gives more precise control over what gets locked and ensures the background remains fixed while the menu is open. I've also updated the CSS accordingly to disable overflow and enforce fixed height:

#page-wrapper.scroll-lock {
  overflow: hidden;
  height: 100vh;
  touch-action: none;
  -webkit-overflow-scrolling: none;
}

This approach keeps the scroll-lock behavior isolated, avoids unintended side effects, and works consistently across devices. Let me know if you’d like me to further tweak or simplify anything.

Thanks again!

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.

mobile menu can't be scrolled, Download not visible

2 participants