-
Notifications
You must be signed in to change notification settings - Fork 12.8k
fix(Enhanced navigation): Change breakpoint for collapsing sidebar #37350
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
Conversation
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: e69d16d The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis PR refactors sidebar toggle logic from device-size flags ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #37350 +/- ##
===========================================
+ Coverage 66.88% 67.89% +1.00%
===========================================
Files 3411 3357 -54
Lines 117029 114902 -2127
Branches 21490 20755 -735
===========================================
- Hits 78274 78008 -266
+ Misses 36071 34210 -1861
Partials 2684 2684
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/meteor/client/providers/LayoutProvider.tsx (1)
40-41: Auto-collapse behavior on breakpoint changes.The
useEffectautomatically syncsisCollapsedwithshouldTogglewhenever the breakpoint changes. This means the sidebar will automatically collapse/expand when users resize their browser window across breakpoints.While this may be the intended behavior, consider if users who manually expanded the sidebar on a small screen would expect it to remain open even after the effect triggers.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (7)
.changeset/hot-cups-smash.md(1 hunks)apps/meteor/client/NavBarV2/NavBarPagesSection.tsx(1 hunks)apps/meteor/client/components/Page/PageHeaderNoShadow.tsx(2 hunks)apps/meteor/client/providers/LayoutProvider.tsx(3 hunks)apps/meteor/client/sidebarv2/SidebarRegion.tsx(2 hunks)apps/meteor/tests/e2e/feature-preview.spec.ts(1 hunks)packages/ui-contexts/src/LayoutContext.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/meteor/tests/e2e/**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.spec.ts: All Playwright test files must be located under apps/meteor/tests/e2e/ and use the .spec.ts extension (e.g., login.spec.ts)
Use descriptive test names that clearly communicate expected behavior
Use test.beforeAll() and test.afterAll() for setup and teardown
Use test.step() to organize complex test scenarios
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) consistently
Prefer web-first assertions (e.g., toBeVisible, toHaveText)
Use expect matchers (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements
Maintain test isolation between test cases
Ensure a clean state for each test execution
Ensure tests run reliably in parallel without shared state conflicts
Files:
apps/meteor/tests/e2e/feature-preview.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}: Write concise, technical TypeScript/JavaScript with accurate typing
Follow DRY by extracting reusable logic into helper functions or page objects
Avoid code comments in the implementation
Files:
apps/meteor/tests/e2e/feature-preview.spec.ts
apps/meteor/tests/e2e/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
apps/meteor/tests/e2e/**/*.{ts,tsx}: Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Store commonly used locators in variables/constants for reuse
Use page.waitFor() with specific conditions and avoid hardcoded timeouts
Implement proper wait strategies for dynamic content
Follow the Page Object Model pattern consistently
Files:
apps/meteor/tests/e2e/feature-preview.spec.ts
🧠 Learnings (10)
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use descriptive test names that clearly communicate expected behavior
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Prefer web-first assertions (e.g., toBeVisible, toHaveText)
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (test, page, expect) consistently
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use test.step() to organize complex test scenarios
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Use expect matchers (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Follow the Page Object Model pattern consistently
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : All Playwright test files must be located under apps/meteor/tests/e2e/ and use the .spec.ts extension (e.g., login.spec.ts)
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx} : Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/page-objects/**/*.ts : Utilize and place Page Object implementations under apps/meteor/tests/e2e/page-objects/
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
📚 Learning: 2025-09-16T22:08:51.490Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-09-16T22:08:51.490Z
Learning: Applies to apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx} : Follow DRY by extracting reusable logic into helper functions or page objects
Applied to files:
apps/meteor/tests/e2e/feature-preview.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🔇 Additional comments (8)
packages/ui-contexts/src/LayoutContext.ts (1)
18-18: LGTM! Clean type definition.The
shouldToggleproperty is correctly added to theLayoutContextValue.sidebartype and initialized with an appropriate default value. This aligns well with the existing toggle-related properties.Also applies to: 60-60
apps/meteor/client/NavBarV2/NavBarPagesSection.tsx (1)
8-19: LGTM! Consistent refactoring to shouldToggle.The change from
isTablettosidebar.shouldToggleproperly centralizes the toggle logic. The SidebarTogglerV2 and NavBarDivider are now rendered based on the unified toggle condition.apps/meteor/tests/e2e/feature-preview.spec.ts (2)
130-134: LGTM! Assertion correctly added for mobile view.The test now explicitly verifies that the sidebar toggler is visible in mobile view (767x510), which aligns with the new
shouldTogglebehavior. The updated description clearly communicates what is being tested.
125-128: Add viewport context to test description for clarity.The test description "should display home and directory inside a menu" removes the helpful context of "in tablet view" but the viewport remains 1023x767 (tablet). Add the viewport context back or rephrase to clarify the behavior being tested, especially since the
shouldTogglelogic (line 35 in LayoutProvider) explicitly depends on breakpoint-aware conditions.apps/meteor/client/components/Page/PageHeaderNoShadow.tsx (1)
18-18: LGTM! Consistent toggle logic refactoring.The change from device-specific flags (
isMobile,isTablet) tosidebar.shouldToggleproperly centralizes the toggle behavior. Both feature preview states now use the unified toggle condition, maintaining the embedded layout check where appropriate.Also applies to: 36-48
apps/meteor/client/sidebarv2/SidebarRegion.tsx (1)
10-10: LGTM! Comprehensive refactoring to shouldToggle.All references to
isTablethave been properly replaced withsidebar.shouldToggle. The mobile overlay styles and toggle button are now consistently controlled by the centralized toggle flag. The logic for determining theopenedstate correctly combines!sidebar.isCollapsedwithsidebar.shouldToggle.Also applies to: 96-107
apps/meteor/client/providers/LayoutProvider.tsx (2)
35-35: Feature flag integration and breakpoint logic verified and correct.The
secondarySidebarfeature flag is properly integrated into the feature preview system (tested with enabled/disabled states infeature-preview.spec.ts) and used consistently throughout the layout components. TheshouldTogglebreakpoint logic is intentional and follows standard responsive design patterns: when the flag is enabled, the sidebar collapses at thelgbreakpoint (desktop); when disabled, it collapses at themdbreakpoint (tablet). No changes required.
85-85: Sidebar width of 280px is intentional and follows responsive design standards.The 280px width is applied when
shouldToggleis true (on mobile/tablet, especially with the secondary sidebar feature enabled). This aligns with industry-standard responsive design practices—Material Design recommends 280–320px for mobile/tablet sidebars, while persistent sidebars on larger screens use the smaller 220px or 240px widths. The change is directly related to the enhanced navigation feature (controlled bysecondSidebarEnabled). No documentation issue exists; the implementation is correct and follows common UI patterns.
tassoevan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following this, it would be neat to discard isMobile and isTablet in favor of specific layout flags.
Proposed changes (including videos or screenshots)
Important
This change is under feature preview
before
after
Issue(s)
Steps to test or reproduce
Further comments
CORE-1515
Summary by CodeRabbit