Skip to content

fix(web): make mobile sidebar auto-collapse idempotent - #9895

Open
BiswasNehaa wants to merge 1 commit into
makeplane:previewfrom
BiswasNehaa:fix/mobile-sidebar-auto-collapse-9356
Open

BiswasNehaa wants to merge 1 commit into
makeplane:previewfrom
BiswasNehaa:fix/mobile-sidebar-auto-collapse-9356

Conversation

@BiswasNehaa

@BiswasNehaa BiswasNehaa commented Sep 26, 2026 •

Copy link
Copy Markdown

Summary

  • Fixes the mobile-sidebar half of [bug]: v1.3.1 web app unusable on iOS/WebKit: unguarded requestIdleCallback crashes workspace pages; expanded sidebar overlays the board and swallows all taps #9356: on viewports narrower than 768px, the sidebar's auto-collapse effect called toggleSidebar() (a flip) instead of toggleSidebar(true) (a set).
  • The effect re-runs on windowSize changes but also reads sidebarCollapsed from closure (the exhaustive-deps lint rule is disabled on it), so a second re-run with a stale value can flip the sidebar back open right after it collapsed.
  • Since the expanded sidebar renders as an absolute, full-height, z-20 overlay on narrow viewports, this left it covering the board and swallowing every tap — reported as "tapping any kanban card does nothing" on iOS/WebKit.
  • Calling toggleSidebar(true) makes the effect idempotent: it can only ever assert "collapsed," so no number of stale re-fires can undo it.

The other bug reported in #9356 (unguarded window.requestIdleCallback) is already fixed upstream via the requestIdle/installIdleCallbackPolyfill wrapper in apps/web/lib/idle-task.ts, so this PR only addresses the sidebar overlay issue.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Test plan

  • Clear site data / use a fresh profile for localhost:3000 (so app_sidebar_collapsed is unset, matching the "fresh visitor" condition in the issue)
  • Emulate a viewport narrower than 768px (e.g. iPhone 13) in DevTools
  • Optionally throttle CPU 4-6x to make the timing race more likely to surface on unpatched code
  • Hard-reload a project board page several times; confirm the sidebar ends up collapsed (not overlaying the board) and app_sidebar_collapsed in localStorage stays "true"
  • Confirm tapping/clicking a work item card opens it

Fixes part of #9356.

Summary by CodeRabbit

  • Bug Fixes
    • On screens narrower than 768 pixels, the sidebar now consistently collapses when it is open.

@CLAassistant

CLAassistant commented Sep 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a4aa4b65-aaf8-43e2-988a-c8aef253e5e3
Commits

Reviewing files that changed from the base of the PR and between 55ef708 and 019c527.

Files selected for processing: 1
  • apps/web/components/sidebar/sidebar-wrapper.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

When the viewport is narrower than 768 pixels, the resize effect now calls toggleSidebar(true) if the sidebar is not collapsed.

Changes: Narrow-Viewport Sidebar Collapse

Layer / File(s) Summary
Explicit sidebar collapse
apps/web/components/sidebar/sidebar-wrapper.tsx
The resize effect explicitly collapses the sidebar on viewports narrower than 768 pixels when it is open.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Merge Risk: Minimal · up to 019c5

The narrow-viewport sidebar change is mergeable with no identified material risk.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title names the main change: the mobile sidebar auto-collapse effect is made idempotent. It follows the fix(web) convention, is one sentence, and matches the summary (toggleSidebar(true) replaces …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description is complete and relevant. It explains the sidebar bug, the cause, the fix, the affected behavior, the change type, the proposed test scenarios, and the related issue. It uses alternati…
Full details: Title check

Explanation

The title names the main change: the mobile sidebar auto-collapse effect is made idempotent. It follows the fix(web) convention, is one sentence, and matches the summary (toggleSidebar(true) replaces the flip). It is specific enough for a teammate scanning history to understand the primary change.

Full details: Description check

Explanation

The description is complete and relevant. It explains the sidebar bug, the cause, the fix, the affected behavior, the change type, the proposed test scenarios, and the related issue. It uses alternative headings for Summary and Test plan, and it does not include a separate References heading, but the required information is present.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

toggleSidebar() with no argument flips the current state. The
auto-collapse effect in SidebarWrapper only re-runs on windowSize
changes but also reads sidebarCollapsed from closure, so a second
re-run with a stale value can flip the sidebar back open right
after it collapsed. On narrow viewports the expanded sidebar is an
absolute, full-height overlay, so this leaves it covering the
board and swallowing every tap.

Call toggleSidebar(true) instead so the effect sets the collapsed
state explicitly and can't undo itself no matter how many times it
re-fires.

Fixes part of makeplane#9356.

This branch has not been deployed

No deployments
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