Skip to content

Conversation

@jmcbgaston
Copy link
Contributor

@jmcbgaston jmcbgaston commented Dec 10, 2025

Screenshots

Before After

Summary by CodeRabbit

  • New Features
    • Responsive toggle: different icons and button sizes by viewport; tooltip placement adapts to toggle direction.
    • Added new icon declarations for modernized icon set.
  • Refactor
    • Modernized toggle rendering with breakpoint-aware logic while preserving public API and click behavior.
  • Styles
    • Added modernized variant styling with hover transform and transition.
  • Tests
    • Updated tests to assert modernized vs legacy class paths and preserve click behavior checks.
  • Chores
    • Pinned web assets dependency to a fixed newer version.

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

@jmcbgaston jmcbgaston requested review from a team as code owners December 10, 2025 00:28
@CLAassistant
Copy link

CLAassistant commented Dec 10, 2025

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2025

Walkthrough

Adds a feature-flagged modernized render path to SidebarToggleButton with breakpoint-aware IconButton icons and tooltip positioning, updates tests for both render paths, pins @box/blueprint-web-assets to 4.88.2, adds Flow icon exports, and introduces a modernized CSS class and hover scope.

Changes

Cohort / File(s) Summary
Component: SidebarToggleButton
src/components/sidebar-toggle-button/SidebarToggleButton.js
Adds a modernized render branch using IconButton with useBreakpoint-driven size and renderModernizedIcon (ChevronDown/ChevronUp on small, RightSidebarChevronOpen/Close on large), computes isDirectionLeft for tooltip side/positioning, forwards onClick/onMouseDown, and preserves the public API.
Tests
src/components/sidebar-toggle-button/__tests__/SidebarToggleButton.test.js
Updates assertions to handle both modernized and legacy render paths: selects data-testid="sidebar-toggle-button", asserts click handler, and conditionally checks for the modernized modifier class vs base class based on the feature flag.
Styles
src/components/sidebar-toggle-button/SidebarToggleButton.scss
Adds .bdl-SidebarToggleButton--modernized { position: relative; } and moves hover/transform/transition rules into .bcs-SidebarNav--modernized .bdl-SidebarToggleButton--modernized:hover.
Flow types
flow-typed/npm/@box/blueprint-web-assets_vx.x.x.js
Adds four new exported icon component declarations under @box/blueprint-web-assets/icons/Medium: ChevronDown, ChevronUp, RightSidebarChevronClose, and RightSidebarChevronOpen.
Dependencies
package.json
Pins @box/blueprint-web-assets from ^4.80.4 to 4.88.2 (removed caret) in both devDependencies and peerDependencies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect breakpoint logic and renderModernizedIcon in SidebarToggleButton.js.
  • Verify tooltip side/position calculations (isDirectionLeft) and props passed to IconButton/Tooltip.
  • Confirm onClick/onMouseDown behavior and preservation of accessibility/data attributes.
  • Review SCSS selector scope and hover transition for regressions.
  • Check Flow type additions for icon exports and dependency pin consistency.

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • tjuanitas
  • bfoxx1906
  • JChan106

Poem

🐰 I swapped old spans for shiny chevrons bright,
Breakpoints tell me when to hop left or right.
A modern class, a test by id — click and see,
Small chevrons tuck, big ones open with glee. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only screenshots and template guidance comments, lacking substantive context about what was changed, why, or implementation details. Add a detailed description explaining the modernized sidebar toggle button changes, the rationale behind the refactor, and how the feature flag integration works.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a modernized version of the sidebar toggle button component with feature flag integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48cf8d5 and 9590491.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • flow-typed/npm/@box/blueprint-web-assets_vx.x.x.js (1 hunks)
  • package.json (2 hunks)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js (4 hunks)
  • src/components/sidebar-toggle-button/SidebarToggleButton.scss (1 hunks)
  • src/components/sidebar-toggle-button/__tests__/SidebarToggleButton.test.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/components/sidebar-toggle-button/tests/SidebarToggleButton.test.js
  • flow-typed/npm/@box/blueprint-web-assets_vx.x.x.js
  • src/components/sidebar-toggle-button/SidebarToggleButton.scss
  • package.json
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: tjuanitas
Repo: box/box-ui-elements PR: 4224
File: package.json:296-297
Timestamp: 2025-08-12T18:04:17.698Z
Learning: In the box-ui-elements project, the team is comfortable with raising peerDependency minimum versions when upgrading blueprint-web packages, even if it's a breaking change for consumers.
📚 Learning: 2025-09-03T18:10:42.760Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-09-03T18:10:29.467Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-06-11T16:30:10.431Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4136
File: src/elements/common/types/SidebarNavigation.ts:16-26
Timestamp: 2025-06-11T16:30:10.431Z
Learning: `VersionSidebarView` intentionally uses the `versionId` field to stay consistent with current URL parameter naming; a potential rename to `fileVersionId` is deferred until React Router is removed.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-07-11T14:43:02.677Z
Learnt from: jpan-box
Repo: box/box-ui-elements PR: 4166
File: src/elements/content-sidebar/SidebarNav.js:126-126
Timestamp: 2025-07-11T14:43:02.677Z
Learning: In the box-ui-elements repository, there's a file-type-based pattern for internationalization: TypeScript files (.tsx) predominantly use the modern useIntl hook (41 vs 15 files), while JavaScript files (.js) predominantly use the legacy injectIntl HOC (64 vs 5 files). New TypeScript components should use useIntl, while existing JavaScript components typically continue using injectIntl for consistency.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
🧬 Code graph analysis (1)
src/components/sidebar-toggle-button/SidebarToggleButton.js (3)
src/elements/content-sidebar/SidebarNav.js (1)
  • isPreviewModernizationEnabled (139-139)
src/elements/content-sidebar/additional-tabs/AdditionalTabTooltip.js (1)
  • isPreviewModernizationEnabled (23-23)
src/elements/common/feature-checking/hooks.js (1)
  • useFeatureConfig (6-9)
⏰ 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: semgrep-cloud-platform/scan
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (8)
src/components/sidebar-toggle-button/SidebarToggleButton.js (8)

66-66: Verify the breakpoint threshold includes Medium.

The condition breakpoint <= Breakpoint.Medium means isBelowMediumView is true for Small, XSmall, and Medium breakpoints. The variable name suggests it should be "below medium" (i.e., < Breakpoint.Medium), but the implementation includes Medium itself. Confirm this is the intended behavior, as it will show mobile-style chevron icons (ChevronDown/ChevronUp) at the Medium breakpoint.


49-53: LGTM! Clean feature flag pattern.

The class name logic correctly applies mutually exclusive base classes based on the feature flag, ensuring the modernized styling doesn't interfere with legacy behavior.


69-79: Icon selection logic looks correct.

The function correctly selects icons based on viewport size and direction. The mobile view uses ChevronDown/ChevronUp (action-oriented), while desktop uses RightSidebarChevron icons (state-oriented). Based on past review comments, this approach has been reviewed and confirmed with design.


55-57: LGTM! Tooltip positioning correctly adapted for each component.

The different tooltip positioning values ('middle-right'/'middle-left' vs 'right'/'left') correctly reflect the different APIs of the legacy Tooltip component versus Blueprint's BPTooltip component.

Also applies to: 67-67


82-92: LGTM! Modernized render path is well-structured.

The IconButton implementation correctly wires up all props, includes proper accessibility attributes, and adapts sizing based on viewport breakpoint. The spread of {...rest} allows for additional customization while maintaining the core behavior.


96-101: LGTM! Legacy path preserved correctly.

The legacy rendering path maintains the original behavior with IconShow/IconHide and PlainButton, ensuring backward compatibility for contexts where the feature flag is disabled.

Also applies to: 104-115


35-117: Well-structured modernization with clean feature flag separation.

The implementation successfully introduces a modernized sidebar toggle button while maintaining full backward compatibility. The feature flag pattern is clean, the responsive behavior is well-thought-out, and event handling is correctly preserved across both paths. The code reflects incorporation of feedback from past reviews regarding mobile icons and hover behavior.


7-13: No issues found. The versions @box/blueprint-web@^12.98.0 and @box/blueprint-web-assets@4.88.2 are correctly pinned in package.json, and all four icons (ChevronDown, ChevronUp, RightSidebarChevronClose, RightSidebarChevronOpen) are successfully imported and used in the modernized rendering path. The packages are compatible.


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
Contributor

@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: 4

🧹 Nitpick comments (3)
src/icons/general/IconRightSidebarChevronOpen.js.flow (1)

6-6: Use import type for Flow type imports.

For clarity and to ensure the import is erased at compile time, use import type syntax for type-only imports in Flow.

-import { Icon } from '../iconTypes';
+import type { Icon } from '../iconTypes';
src/icons/general/IconRightSidebarChevronClose.js.flow (1)

6-6: Use import type for Flow type imports.

-import { Icon } from '../iconTypes';
+import type { Icon } from '../iconTypes';
src/components/sidebar-toggle-button/SidebarToggleButton.js (1)

57-75: Reduce duplication in IconButton rendering.

The two IconButton blocks are nearly identical, differing only in the icon selection logic. Consider extracting the icon selection into a variable to eliminate duplication.

     if (isPreviewModernizationEnabled) {
         const tooltipPositionModernized = isDirectionLeft ? DIRECTION_RIGHT : DIRECTION_LEFT;
+        const modernizedIcon = isDirectionLeft
+            ? (isOpen ? IconRightSidebarChevronOpen : IconRightSidebarChevronClose)
+            : (isOpen ? IconRightSidebarChevronClose : IconRightSidebarChevronOpen);
         return (
             <BPTooltip content={intlText} side={tooltipPositionModernized}>
-                {isDirectionLeft ? (
-                    <IconButton
-                        aria-label={intlText}
-                        icon={isOpen ? IconRightSidebarChevronOpen : IconRightSidebarChevronClose}
-                        onClick={onClick}
-                        size="large"
-                        variant="high-contrast"
-                        {...rest}
-                    />
-                ) : (
-                    <IconButton
-                        aria-label={intlText}
-                        icon={isOpen ? IconRightSidebarChevronClose : IconRightSidebarChevronOpen}
-                        onClick={onClick}
-                        size="large"
-                        variant="high-contrast"
-                        {...rest}
-                    />
-                )}
+                <IconButton
+                    aria-label={intlText}
+                    icon={modernizedIcon}
+                    onClick={onClick}
+                    size="large"
+                    variant="high-contrast"
+                    {...rest}
+                />
             </BPTooltip>
         );
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 121de79 and 5f2fbbd.

📒 Files selected for processing (5)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js (2 hunks)
  • src/icons/general/IconRightSidebarChevronClose.js.flow (1 hunks)
  • src/icons/general/IconRightSidebarChevronClose.tsx (1 hunks)
  • src/icons/general/IconRightSidebarChevronOpen.js.flow (1 hunks)
  • src/icons/general/IconRightSidebarChevronOpen.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.
📚 Learning: 2025-09-03T18:10:42.760Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-09-03T18:10:29.467Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-07-11T14:43:02.677Z
Learnt from: jpan-box
Repo: box/box-ui-elements PR: 4166
File: src/elements/content-sidebar/SidebarNav.js:126-126
Timestamp: 2025-07-11T14:43:02.677Z
Learning: In the box-ui-elements repository, there's a file-type-based pattern for internationalization: TypeScript files (.tsx) predominantly use the modern useIntl hook (41 vs 15 files), while JavaScript files (.js) predominantly use the legacy injectIntl HOC (64 vs 5 files). New TypeScript components should use useIntl, while existing JavaScript components typically continue using injectIntl for consistency.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-06-17T13:30:02.172Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4144
File: src/elements/content-sidebar/versions/VersionsList.js:24-33
Timestamp: 2025-06-17T13:30:02.172Z
Learning: In the box-ui-elements codebase, Flow components use .flow.js type definition files, not TypeScript .ts files. The InternalSidebarNavigation type is a union type where different variants may have different properties like versionId, and proper type safety is ensured through conditional checks in methods like getSelectedVersionId.

Applied to files:

  • src/icons/general/IconRightSidebarChevronOpen.js.flow
  • src/icons/general/IconRightSidebarChevronClose.js.flow
📚 Learning: 2025-09-03T18:30:44.447Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarPanels.js:0-0
Timestamp: 2025-09-03T18:30:44.447Z
Learning: In the CustomSidebarPanel type, the component field is required (React.ComponentType<any>), so runtime checks for component existence are unnecessary since Flow will catch missing components at compile time. User fpan225 prefers to rely on the type system rather than adding redundant runtime checks.

Applied to files:

  • src/icons/general/IconRightSidebarChevronOpen.js.flow
  • src/icons/general/IconRightSidebarChevronClose.js.flow
📚 Learning: 2025-06-25T13:09:45.168Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4160
File: src/elements/content-sidebar/SidebarToggle.js:13-19
Timestamp: 2025-06-25T13:09:45.168Z
Learning: Files with `flow` or `flow strict` comments at the top use Flow type syntax, not TypeScript. Flow type definitions like `type Props = { ... }` and type imports like `type { RouterHistory }` are valid Flow syntax and should not be flagged as TypeScript-only features.

Applied to files:

  • src/icons/general/IconRightSidebarChevronOpen.js.flow
  • src/icons/general/IconRightSidebarChevronClose.js.flow
📚 Learning: 2025-06-25T13:09:54.538Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4160
File: src/elements/content-sidebar/SidebarToggle.js:21-27
Timestamp: 2025-06-25T13:09:54.538Z
Learning: The box-ui-elements project uses Flow for type annotations in JavaScript files, as indicated by flow directives in file headers. Type annotations like `: Props` are valid Flow syntax, not TypeScript syntax.

Applied to files:

  • src/icons/general/IconRightSidebarChevronOpen.js.flow
  • src/icons/general/IconRightSidebarChevronClose.js.flow
🧬 Code graph analysis (1)
src/components/sidebar-toggle-button/SidebarToggleButton.js (1)
src/elements/content-sidebar/SidebarNav.js (1)
  • isPreviewModernizationEnabled (139-139)
⏰ 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). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (2)
src/components/sidebar-toggle-button/SidebarToggleButton.js (2)

46-51: Approve non-modernized icon rendering logic.

The renderIcon function cleanly handles the direction-based icon selection for the legacy path, with proper sizing.


53-56: Modernized rendering path looks good.

The feature flag check and tooltip positioning logic are correctly implemented, consistent with the pattern used in other components like SidebarNav.js and AdditionalTabTooltip.js.

@jmcbgaston jmcbgaston force-pushed the modernize-sidebar-toggle-button branch from 7f603b1 to a2de97c Compare December 10, 2025 21:52
Copy link
Contributor

@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: 0

♻️ Duplicate comments (3)
src/icons/general/IconRightSidebarChevronClose.tsx (1)

10-22: SVG attributes correctly updated to camelCase.

The previously flagged kebab-case attributes have been fixed. All SVG attributes now use proper JSX camelCase (fillOpacity, fillRule, clipRule).

src/icons/general/IconRightSidebarChevronClose.js.flow (1)

11-23: SVG attributes correctly updated to camelCase.

The Flow version also has the corrected camelCase attributes. Implementation is consistent with the TypeScript version.

src/icons/general/IconRightSidebarChevronOpen.tsx (1)

10-22: SVG attributes correctly updated to camelCase.

All JSX attributes are properly formatted in camelCase. The implementation is consistent with the companion Close icon.

🧹 Nitpick comments (1)
src/components/sidebar-toggle-button/SidebarToggleButton.js (1)

64-84: Consider reducing duplication in IconButton blocks.

The left and right direction branches (lines 64-73 and 74-83) are nearly identical, differing only in the icon prop. Consider extracting the icon selection logic into a variable to eliminate duplication.

Apply this refactor:

     if (isPreviewModernizationEnabled) {
         const tooltipPositionModernized = isDirectionLeft ? DIRECTION_RIGHT : DIRECTION_LEFT;
+        const selectedIcon = isDirectionLeft 
+            ? (isOpen ? IconRightSidebarChevronOpen : IconRightSidebarChevronClose)
+            : (isOpen ? IconRightSidebarChevronClose : IconRightSidebarChevronOpen);
         return (
             <BPTooltip content={intlText} side={tooltipPositionModernized}>
-                {isDirectionLeft ? (
-                    <IconButton
-                        aria-label={intlText}
-                        icon={isOpen ? IconRightSidebarChevronOpen : IconRightSidebarChevronClose}
-                        onClick={onClick}
-                        onMouseDown={mouseDownHandler}
-                        size="large"
-                        variant="high-contrast"
-                        {...rest}
-                    />
-                ) : (
-                    <IconButton
-                        aria-label={intlText}
-                        icon={isOpen ? IconRightSidebarChevronClose : IconRightSidebarChevronOpen}
-                        onClick={onClick}
-                        onMouseDown={mouseDownHandler}
-                        size="large"
-                        variant="high-contrast"
-                        {...rest}
-                    />
-                )}
+                <IconButton
+                    aria-label={intlText}
+                    icon={selectedIcon}
+                    onClick={onClick}
+                    onMouseDown={mouseDownHandler}
+                    size="large"
+                    variant="high-contrast"
+                    {...rest}
+                />
             </BPTooltip>
         );
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f603b1 and a2de97c.

📒 Files selected for processing (5)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js (4 hunks)
  • src/icons/general/IconRightSidebarChevronClose.js.flow (1 hunks)
  • src/icons/general/IconRightSidebarChevronClose.tsx (1 hunks)
  • src/icons/general/IconRightSidebarChevronOpen.js.flow (1 hunks)
  • src/icons/general/IconRightSidebarChevronOpen.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/icons/general/IconRightSidebarChevronOpen.js.flow
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.
📚 Learning: 2025-06-17T13:30:02.172Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4144
File: src/elements/content-sidebar/versions/VersionsList.js:24-33
Timestamp: 2025-06-17T13:30:02.172Z
Learning: In the box-ui-elements codebase, Flow components use .flow.js type definition files, not TypeScript .ts files. The InternalSidebarNavigation type is a union type where different variants may have different properties like versionId, and proper type safety is ensured through conditional checks in methods like getSelectedVersionId.

Applied to files:

  • src/icons/general/IconRightSidebarChevronClose.js.flow
  • src/icons/general/IconRightSidebarChevronOpen.tsx
📚 Learning: 2025-09-03T18:30:44.447Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarPanels.js:0-0
Timestamp: 2025-09-03T18:30:44.447Z
Learning: In the CustomSidebarPanel type, the component field is required (React.ComponentType<any>), so runtime checks for component existence are unnecessary since Flow will catch missing components at compile time. User fpan225 prefers to rely on the type system rather than adding redundant runtime checks.

Applied to files:

  • src/icons/general/IconRightSidebarChevronClose.js.flow
📚 Learning: 2025-06-25T13:09:45.168Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4160
File: src/elements/content-sidebar/SidebarToggle.js:13-19
Timestamp: 2025-06-25T13:09:45.168Z
Learning: Files with `flow` or `flow strict` comments at the top use Flow type syntax, not TypeScript. Flow type definitions like `type Props = { ... }` and type imports like `type { RouterHistory }` are valid Flow syntax and should not be flagged as TypeScript-only features.

Applied to files:

  • src/icons/general/IconRightSidebarChevronClose.js.flow
  • src/icons/general/IconRightSidebarChevronOpen.tsx
📚 Learning: 2025-06-25T13:09:54.538Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4160
File: src/elements/content-sidebar/SidebarToggle.js:21-27
Timestamp: 2025-06-25T13:09:54.538Z
Learning: The box-ui-elements project uses Flow for type annotations in JavaScript files, as indicated by flow directives in file headers. Type annotations like `: Props` are valid Flow syntax, not TypeScript syntax.

Applied to files:

  • src/icons/general/IconRightSidebarChevronClose.js.flow
📚 Learning: 2025-09-03T18:10:42.760Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.

Applied to files:

  • src/icons/general/IconRightSidebarChevronClose.js.flow
  • src/icons/general/IconRightSidebarChevronClose.tsx
  • src/components/sidebar-toggle-button/SidebarToggleButton.js
  • src/icons/general/IconRightSidebarChevronOpen.tsx
📚 Learning: 2025-09-03T18:10:29.467Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-07-11T14:43:02.677Z
Learnt from: jpan-box
Repo: box/box-ui-elements PR: 4166
File: src/elements/content-sidebar/SidebarNav.js:126-126
Timestamp: 2025-07-11T14:43:02.677Z
Learning: In the box-ui-elements repository, there's a file-type-based pattern for internationalization: TypeScript files (.tsx) predominantly use the modern useIntl hook (41 vs 15 files), while JavaScript files (.js) predominantly use the legacy injectIntl HOC (64 vs 5 files). New TypeScript components should use useIntl, while existing JavaScript components typically continue using injectIntl for consistency.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
⏰ 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). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (3)
src/components/sidebar-toggle-button/SidebarToggleButton.js (3)

6-6: Appropriate imports for modernization.

The blueprint-web components (IconButton, BPTooltip) and new chevron icons are correctly imported to support the modernized rendering path.

Also applies to: 9-10


44-51: Clean refactoring of helper logic.

Extracting isDirectionLeft and using it for tooltip positioning improves readability. The renderIcon function appropriately maintains the existing icon logic for the non-modernized path.


60-101: Modernization approach maintains backward compatibility.

The feature-flagged modernization path correctly uses blueprint-web components while preserving the existing non-modernized behavior. The icon selection logic is correct for both left and right direction sidebars, and the mouseDown event handling is consistently applied in both paths.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (2)
src/components/sidebar-toggle-button/__tests__/SidebarToggleButton.test.js (1)

60-70: Stable test hook via data-testid looks good; consider aligning name and helper

Switching to screen.getByTestId('sidebar-toggle-button') matches the new shared data-testid on both legacy and modernized paths, so the click assertion remains robust. You may want to (a) tweak the test description to focus on click behavior now that it no longer inspects the rendered variant, and/or (b) switch to queryByTestId plus an explicit existence assertion to match our preferred pattern for test IDs. Based on learnings, this follows the existing guidance around queryByTestId usage.

src/components/sidebar-toggle-button/SidebarToggleButton.js (1)

6-10: Modernized IconButton path and chevron icons look consistent; consider mirroring type="button"

Using BPTooltip plus IconButton for the modernization branch, with direction-aware chevron icons and a shared data-testid="sidebar-toggle-button", keeps behavior aligned with the legacy path while preserving the onMouseDown stop-propagation behavior covered by tests. To fully mirror the non-modernized PlainButton usage and avoid any risk of accidental form submission, consider also passing type="button" through to IconButton, assuming its API forwards that prop to the underlying button element; worth a quick check against the @box/blueprint-web IconButton contract.

Also applies to: 61-86

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2de97c and bd1fe9f.

📒 Files selected for processing (2)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js (4 hunks)
  • src/components/sidebar-toggle-button/__tests__/SidebarToggleButton.test.js (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.
📚 Learning: 2025-08-27T17:03:48.322Z
Learnt from: bxie-box
Repo: box/box-ui-elements PR: 4250
File: src/features/classification/applied-by-ai-classification-reason/__tests__/AppliedByAiClassificationReason.test.tsx:44-51
Timestamp: 2025-08-27T17:03:48.322Z
Learning: In test files for bxie-box, prefer using queryByTestId over getByTestId when testing for expected elements that should always exist, as null access serves as validation for regressions or unexpected changes rather than masking issues with defensive assertions.

Applied to files:

  • src/components/sidebar-toggle-button/__tests__/SidebarToggleButton.test.js
📚 Learning: 2025-09-03T18:10:42.760Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.

Applied to files:

  • src/components/sidebar-toggle-button/__tests__/SidebarToggleButton.test.js
  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-09-03T18:10:29.467Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.

Applied to files:

  • src/components/sidebar-toggle-button/__tests__/SidebarToggleButton.test.js
  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-07-11T14:43:02.677Z
Learnt from: jpan-box
Repo: box/box-ui-elements PR: 4166
File: src/elements/content-sidebar/SidebarNav.js:126-126
Timestamp: 2025-07-11T14:43:02.677Z
Learning: In the box-ui-elements repository, there's a file-type-based pattern for internationalization: TypeScript files (.tsx) predominantly use the modern useIntl hook (41 vs 15 files), while JavaScript files (.js) predominantly use the legacy injectIntl HOC (64 vs 5 files). New TypeScript components should use useIntl, while existing JavaScript components typically continue using injectIntl for consistency.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
⏰ 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). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (1)
src/components/sidebar-toggle-button/SidebarToggleButton.js (1)

44-47: Directional helper + renderIcon reuse keep behavior consistent and support testing

Extracting isDirectionLeft, tooltipPosition, and renderIcon keeps the existing left/right + open/closed icon logic intact while simplifying reuse between branches. Adding data-testid="sidebar-toggle-button" to the PlainButton with {...rest} spread last gives tests a stable hook but still lets consumers override attributes (including data-testid) when needed, which matches the intended override pattern for data-* props. Based on learnings, this ordering is aligned with prior SidebarNav design.

Also applies to: 91-102

Copy link
Contributor

@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 bd1fe9f and bbd8941.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json (2 hunks)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: tjuanitas
Repo: box/box-ui-elements PR: 4224
File: package.json:296-297
Timestamp: 2025-08-12T18:04:17.698Z
Learning: In the box-ui-elements project, the team is comfortable with raising peerDependency minimum versions when upgrading blueprint-web packages, even if it's a breaking change for consumers.
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.
📚 Learning: 2025-08-12T18:04:17.698Z
Learnt from: tjuanitas
Repo: box/box-ui-elements PR: 4224
File: package.json:296-297
Timestamp: 2025-08-12T18:04:17.698Z
Learning: In the box-ui-elements project, the team is comfortable with raising peerDependency minimum versions when upgrading blueprint-web packages, even if it's a breaking change for consumers.

Applied to files:

  • package.json
⏰ 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). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (1)
package.json (1)

128-128: Consistent dependency and peerDependency versions.

Both devDependencies and peerDependencies are updated in sync, which is good practice. Based on learnings, the team is comfortable with raising blueprint-web peerDependency versions.

Also applies to: 300-300

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
src/components/sidebar-toggle-button/SidebarToggleButton.scss (1)

40-47: Consider moving transition outside hover for symmetrical animation.

The transition property is currently inside the :hover state, which means it applies when hovering in but not when hovering out. For a smoother user experience, move the transition to the base element.

Apply this diff to enable symmetrical hover animation:

 .bcs-SidebarNav--modernized {
     .bdl-SidebarToggleButton--modernized {
+        svg {
+            transition: transform 150ms;
+        }
+
         &:hover svg {
             transform: scale(1.09);
-            transition: transform 150ms;
         }
     }
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfced4b and 8e6987f.

📒 Files selected for processing (2)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js (3 hunks)
  • src/components/sidebar-toggle-button/SidebarToggleButton.scss (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: tjuanitas
Repo: box/box-ui-elements PR: 4224
File: package.json:296-297
Timestamp: 2025-08-12T18:04:17.698Z
Learning: In the box-ui-elements project, the team is comfortable with raising peerDependency minimum versions when upgrading blueprint-web packages, even if it's a breaking change for consumers.
📚 Learning: 2025-09-03T18:10:42.760Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.scss
📚 Learning: 2025-09-03T18:10:29.467Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.scss
⏰ 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: lint_test_build
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Summary
🔇 Additional comments (1)
src/components/sidebar-toggle-button/SidebarToggleButton.scss (1)

33-38: LGTM! Clean separation of modernized variant.

The new .bdl-SidebarToggleButton--modernized class properly establishes a stacking context to address the clickability issue. The explanatory comment is helpful and references the related file.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
package.json (1)

300-300: Consider keeping the caret for peerDependency flexibility.

The caret was removed, making this an exact version constraint (4.88.2 instead of ^4.88.2). This forces consumers to install exactly version 4.88.2 and prevents them from using compatible newer versions (e.g., 4.88.3 or 4.89.0).

If the exact version pin is intentional due to specific asset requirements for the modernized sidebar toggle, please confirm. Otherwise, consider restoring the caret to allow compatible updates.

Based on learnings, the team is comfortable with breaking changes for blueprint packages.

Apply this diff if caret should be restored:

-    "@box/blueprint-web-assets": "4.88.2",
+    "@box/blueprint-web-assets": "^4.88.2",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e6987f and b6110f5.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (1)
  • package.json (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: tjuanitas
Repo: box/box-ui-elements PR: 4224
File: package.json:296-297
Timestamp: 2025-08-12T18:04:17.698Z
Learning: In the box-ui-elements project, the team is comfortable with raising peerDependency minimum versions when upgrading blueprint-web packages, even if it's a breaking change for consumers.
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.
Learnt from: bxie-box
Repo: box/box-ui-elements PR: 4250
File: src/features/classification/applied-by-ai-classification-reason/__tests__/AppliedByAiClassificationReason.test.tsx:44-51
Timestamp: 2025-08-27T17:03:48.322Z
Learning: In test files for bxie-box, prefer using queryByTestId over getByTestId when testing for expected elements that should always exist, as null access serves as validation for regressions or unexpected changes rather than masking issues with defensive assertions.
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.
📚 Learning: 2025-08-12T18:04:17.698Z
Learnt from: tjuanitas
Repo: box/box-ui-elements PR: 4224
File: package.json:296-297
Timestamp: 2025-08-12T18:04:17.698Z
Learning: In the box-ui-elements project, the team is comfortable with raising peerDependency minimum versions when upgrading blueprint-web packages, even if it's a breaking change for consumers.

Applied to files:

  • package.json
⏰ 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: lint_test_build
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Summary
🔇 Additional comments (1)
package.json (1)

128-128: No action needed. Version 4.88.2 of @box/blueprint-web-assets is published and available on npm.

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
src/components/sidebar-toggle-button/SidebarToggleButton.js (1)

65-94: LGTM! Well-structured modernized render path with breakpoint-aware icon selection.

The implementation correctly handles three scenarios: mobile view with chevrons, desktop left-sidebar, and desktop right-sidebar. All necessary props, handlers, and accessibility attributes are properly maintained.

Consider adding a brief comment above renderModernizedIcon explaining the icon naming convention (e.g., "RightSidebarChevronOpen represents the sidebar's visual state, not the action"), as the relationship between icon names and the isOpen prop might not be immediately intuitive for future maintainers.

+        // Icon selection based on breakpoint and sidebar position
+        // Note: Icon names reflect the visual chevron direction, not the action
         const renderModernizedIcon = () => {
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e3e795 and e3a7432.

📒 Files selected for processing (1)
  • src/components/sidebar-toggle-button/SidebarToggleButton.js (4 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: tjuanitas
Repo: box/box-ui-elements PR: 4224
File: package.json:296-297
Timestamp: 2025-08-12T18:04:17.698Z
Learning: In the box-ui-elements project, the team is comfortable with raising peerDependency minimum versions when upgrading blueprint-web packages, even if it's a breaking change for consumers.
📚 Learning: 2025-09-03T18:10:42.760Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:195-206
Timestamp: 2025-09-03T18:10:42.760Z
Learning: In src/elements/content-sidebar/SidebarNav.js, the maintainer wants users to be able to override data-* attributes (data-resin-target, data-target-id, data-testid) through navButtonProps for custom tabs. The spread of {...navButtonProps} should come after the data-* attributes to allow overriding, not before them.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-09-03T18:10:29.467Z
Learnt from: fpan225
Repo: box/box-ui-elements PR: 4239
File: src/elements/content-sidebar/SidebarNav.js:94-106
Timestamp: 2025-09-03T18:10:29.467Z
Learning: In the ContentSidebar CustomSidebarPanel API, the navButtonProps spread should come after explicit data-* attributes to allow users to override analytics tracking attributes like data-resin-target, data-target-id, and data-testid when needed. This is intentional API design for flexibility.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-06-11T16:30:10.431Z
Learnt from: rafalmaksymiuk
Repo: box/box-ui-elements PR: 4136
File: src/elements/common/types/SidebarNavigation.ts:16-26
Timestamp: 2025-06-11T16:30:10.431Z
Learning: `VersionSidebarView` intentionally uses the `versionId` field to stay consistent with current URL parameter naming; a potential rename to `fileVersionId` is deferred until React Router is removed.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
📚 Learning: 2025-07-11T14:43:02.677Z
Learnt from: jpan-box
Repo: box/box-ui-elements PR: 4166
File: src/elements/content-sidebar/SidebarNav.js:126-126
Timestamp: 2025-07-11T14:43:02.677Z
Learning: In the box-ui-elements repository, there's a file-type-based pattern for internationalization: TypeScript files (.tsx) predominantly use the modern useIntl hook (41 vs 15 files), while JavaScript files (.js) predominantly use the legacy injectIntl HOC (64 vs 5 files). New TypeScript components should use useIntl, while existing JavaScript components typically continue using injectIntl for consistency.

Applied to files:

  • src/components/sidebar-toggle-button/SidebarToggleButton.js
🧬 Code graph analysis (1)
src/components/sidebar-toggle-button/SidebarToggleButton.js (3)
src/elements/content-sidebar/SidebarNav.js (1)
  • isPreviewModernizationEnabled (139-139)
src/elements/content-sidebar/additional-tabs/AdditionalTabTooltip.js (1)
  • isPreviewModernizationEnabled (23-23)
src/elements/common/feature-checking/hooks.js (1)
  • useFeatureConfig (6-9)
⏰ 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: lint_test_build
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Summary
🔇 Additional comments (6)
src/components/sidebar-toggle-button/SidebarToggleButton.js (6)

7-13: LGTM! Clean import additions for the modernized path.

The Blueprint Web imports are properly structured, and the BPTooltip alias appropriately avoids conflicts with the existing legacy Tooltip component.


43-44: LGTM! Proper hook usage for responsive and feature-flagged behavior.

The useBreakpoint and useFeatureConfig hooks are correctly placed and follow the established patterns in the codebase.


49-53: LGTM! Proper conditional class application.

The classNames logic correctly applies mutually exclusive classes based on the feature flag while maintaining the shared bdl-is-collapsed state class.


55-56: LGTM! Clear helper variables for direction logic.

The isDirectionLeft boolean and derived tooltipPosition improve readability and are correctly used in both render paths.


96-101: LGTM! Clean icon helper for the legacy render path.

The renderIcon function provides clear, direction-aware icon selection using semantic icon names.


103-116: LGTM! Legacy render path properly maintained.

The legacy path is well-preserved with a nice refactor that extracts icon rendering into the renderIcon helper, improving code organization while maintaining all existing functionality.

zhirongwang
zhirongwang previously approved these changes Dec 16, 2025
Copy link
Contributor

@JChan106 JChan106 left a comment

Choose a reason for hiding this comment

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

lgtm

@jmcbgaston jmcbgaston force-pushed the modernize-sidebar-toggle-button branch from 87fbef7 to 9590491 Compare December 17, 2025 17:23
@jmcbgaston jmcbgaston removed the queued label Dec 17, 2025
@mergify mergify bot added the queued label Dec 17, 2025
@mergify mergify bot merged commit 8fc2b86 into box:master Dec 17, 2025
8 checks passed
@mergify
Copy link
Contributor

mergify bot commented Dec 17, 2025

Merge Queue Status

✅ The pull request has been merged at bde9f79

This pull request spent 6 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge

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.

5 participants