Skip to content

Conversation

@rishabh30Gupta
Copy link

@rishabh30Gupta rishabh30Gupta commented Dec 13, 2025

This commit fixes multiple UX issues with the mobile/tablet sidebar:

Issues Fixed:

  • Background interaction bleed-through: Users could click/interact with main content while sidebar was open
  • Missing scroll lock: Background content could scroll while sidebar was active
  • Non-scrollable sidebar: Drawer content would be cut off if it exceeded viewport height
  • Accessibility improvements: Added proper ARIA labels

Changes Made:

  1. Added body scroll lock using useEffect hook

    • Locks scroll when sidebar opens with overflow:hidden and position:fixed
    • Preserves and restores scroll position on close
    • Prevents background scrolling completely
  2. Enhanced overlay/scrim interaction blocking

    • Added touch-none class to prevent touch events
    • Added explicit pointerEvents: 'auto' for better blocking
    • Added aria-hidden for accessibility
  3. Made sidebar content scrollable

    • Restructured sidebar with flexbox (flex flex-col)
    • Header section: flex-shrink-0 (fixed)
    • Content area: flex-1 overflow-y-auto (scrollable)
  4. Improved accessibility

    • Added aria-label to close button
    • Added aria-hidden to overlay

Testing:

  • Verified background clicks are blocked (0 interactions)
  • Verified scroll lock works (0px scroll achieved)
  • Verified sidebar content is scrollable
  • Verified overlay closes sidebar on click

Resolves issues with sidebar UX and interaction blocking.

Description

Include a summary of the change and which issue is fixed. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please mark the options that are relevant.

  • Updated UI/UX
  • Improved the business logic of code
  • Added new feature
  • Other

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Summary by CodeRabbit

  • New Features
    • Mobile sidebar now prevents page scrolling when open
    • Added backdrop overlay to mobile sidebar to block background interactions
    • Added close button to mobile sidebar header for easier dismissal

✏️ Tip: You can customize this high-level summary in your review settings.

This commit fixes multiple UX issues with the mobile/tablet sidebar:

Issues Fixed:
- Background interaction bleed-through: Users could click/interact with main content while sidebar was open
- Missing scroll lock: Background content could scroll while sidebar was active
- Non-scrollable sidebar: Drawer content would be cut off if it exceeded viewport height
- Accessibility improvements: Added proper ARIA labels

Changes Made:
1. Added body scroll lock using useEffect hook
   - Locks scroll when sidebar opens with overflow:hidden and position:fixed
   - Preserves and restores scroll position on close
   - Prevents background scrolling completely

2. Enhanced overlay/scrim interaction blocking
   - Added touch-none class to prevent touch events
   - Added explicit pointerEvents: 'auto' for better blocking
   - Added aria-hidden for accessibility

3. Made sidebar content scrollable
   - Restructured sidebar with flexbox (flex flex-col)
   - Header section: flex-shrink-0 (fixed)
   - Content area: flex-1 overflow-y-auto (scrollable)

4. Improved accessibility
   - Added aria-label to close button
   - Added aria-hidden to overlay

Testing:
- Verified background clicks are blocked (0 interactions)
- Verified scroll lock works (0px scroll achieved)
- Verified sidebar content is scrollable
- Verified overlay closes sidebar on click

Resolves issues with sidebar UX and interaction blocking.
@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

The Header component now includes enhanced mobile sidebar interactions: scroll-lock when the sidebar is open, an overlay backdrop to block page interaction, a dedicated close button, and restructured sidebar layout with separate header and scrollable content areas.

Changes

Cohort / File(s) Summary
Mobile Sidebar UX Enhancements
client/app/components/Header/Header.tsx
Added useEffect hook to lock body scroll when sidebar opens (captures scrollY, applies fixed positioning, restores on close). Introduced overlay backdrop with accessibility attributes. Added close button in sidebar header with ARIA label. Restructured sidebar layout with dedicated header area and separate scrollable content region. Minor formatting adjustments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify scroll-lock implementation correctly captures and restores scrollY position across mount/unmount cycles
  • Confirm overlay backdrop has appropriate event handlers and doesn't interfere with sidebar interactions
  • Review close button click handler and ARIA label for accessibility compliance
  • Validate restructured sidebar layout maintains proper item highlighting and menu functionality
  • Check for any z-index or positioning conflicts with the overlay and sidebar layering

Poem

🐰 A sidebar that scrolls with grace,
With overlay keeping its place,
A close button neat, oh what a treat!
The mobile experience—complete and sweet,
No more janky jumps, just smooth retreat! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing sidebar interaction and scroll issues. It's specific, concise, and directly reflects the primary purpose of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d3a4dd and 44beade.

📒 Files selected for processing (1)
  • client/app/components/Header/Header.tsx (5 hunks)
🔇 Additional comments (2)
client/app/components/Header/Header.tsx (2)

139-148: Effective overlay implementation for blocking background interaction.

The combination of touch-none, explicit pointerEvents: 'auto', and aria-hidden="true" properly prevents background interaction while maintaining accessibility. The overlay correctly closes the sidebar on click.


150-187: Well-structured scrollable sidebar implementation.

The flexbox layout with flex-shrink-0 header and flex-1 overflow-y-auto content area correctly enables scrolling when sidebar content exceeds viewport height. The close button's aria-label enhances accessibility.

Comment on lines +29 to +61
// Lock body scroll when sidebar is open
useEffect(() => {
if (isSidebarOpen) {
// Save current scroll position
const scrollY = window.scrollY;

// Lock scroll
document.body.style.overflow = 'hidden';
document.body.style.position = 'fixed';
document.body.style.top = `-${scrollY}px`;
document.body.style.width = '100%';
} else {
// Restore scroll
const scrollY = document.body.style.top;
document.body.style.overflow = '';
document.body.style.position = '';
document.body.style.top = '';
document.body.style.width = '';

// Restore scroll position
if (scrollY) {
window.scrollTo(0, parseInt(scrollY || '0') * -1);
}
}

// Cleanup on unmount
return () => {
document.body.style.overflow = '';
document.body.style.position = '';
document.body.style.top = '';
document.body.style.width = '';
};
}, [isSidebarOpen]);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Restore scroll position on unmount to handle edge cases.

The scroll lock implementation correctly handles the open/close flow, but the cleanup function (lines 55-60) doesn't restore the scroll position if the component unmounts while the sidebar is open. This could leave users at scroll position 0 during navigation or hot reloads.

Consider capturing scrollY in the effect and restoring it in the cleanup:

  // Lock body scroll when sidebar is open
  useEffect(() => {
    if (isSidebarOpen) {
      // Save current scroll position
      const scrollY = window.scrollY;

      // Lock scroll
      document.body.style.overflow = 'hidden';
      document.body.style.position = 'fixed';
      document.body.style.top = `-${scrollY}px`;
      document.body.style.width = '100%';
-    } else {
-      // Restore scroll
-      const scrollY = document.body.style.top;
-      document.body.style.overflow = '';
-      document.body.style.position = '';
-      document.body.style.top = '';
-      document.body.style.width = '';
-
-      // Restore scroll position
-      if (scrollY) {
-        window.scrollTo(0, parseInt(scrollY || '0') * -1);
-      }
-    }
-
-    // Cleanup on unmount
-    return () => {
-      document.body.style.overflow = '';
-      document.body.style.position = '';
-      document.body.style.top = '';
-      document.body.style.width = '';
-    };
+
+      // Cleanup: restore on close or unmount
+      return () => {
+        document.body.style.overflow = '';
+        document.body.style.position = '';
+        document.body.style.top = '';
+        document.body.style.width = '';
+        window.scrollTo(0, scrollY);
+      };
+    }
  }, [isSidebarOpen]);
🤖 Prompt for AI Agents
In client/app/components/Header/Header.tsx around lines 29 to 61, the cleanup
currently resets body styles but does not restore the saved scroll position if
the component unmounts while the sidebar is open; capture the scrollY value when
locking scroll (e.g., store it in a ref or a local variable closed over by the
cleanup) and in the cleanup restore window.scrollTo using that saved value
(convert the stored negative top back to a positive Y), and ensure the
open/close branch also uses the same stored value so both unmount and
sidebar-close restore the original scroll position and clear body styles.

@Ronnieraj37 Ronnieraj37 merged commit 44beade into AOSSIE-Org:main Dec 30, 2025
1 check passed
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.

2 participants