Skip to content

refactor(dropdown-menu): migrate DropdownMenu from Flow to TypeScript - #4731

Open
bonchevskyi wants to merge 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-dropdown-menu
Open

refactor(dropdown-menu): migrate DropdownMenu from Flow to TypeScript#4731
bonchevskyi wants to merge 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-dropdown-menu

Conversation

@bonchevskyi

@bonchevskyi bonchevskyi commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Convert DropdownMenu component to TypeScript

This PR converts src/components/dropdown-menu from JavaScript with Flow to TypeScript.

Changes

  • Converted DropdownMenu.js and MenuToggle.js to .tsx with exported props interfaces
  • Converted index.js to index.ts, re-exporting the components and types
  • Converted stories and tests to TypeScript
  • Created .js.flow files for backward compatibility
  • Added DropdownMenu exports to src/components/index.ts

Testing

  • Ran tests for src/components/dropdown-menu; all 45 pass and the snapshot matches previous output
  • yarn lint:ts, ESLint, and Flow checks pass
  • Storybook production build completed successfully

Summary by CodeRabbit

  • New Features
    • Added a reusable dropdown menu with keyboard and mouse support, outside-click dismissal, focus restoration, and accessibility enhancements.
    • Added configurable menu positioning, responsive behavior, and open/close callbacks.
    • Added a menu toggle with a caret icon.
    • Exposed dropdown menu components and their property types through the public component library.
  • Tests
    • Expanded coverage for keyboard interactions, focus handling, outside clicks, and menus rendered in the document body.

@bonchevskyi
bonchevskyi requested a review from a team as a code owner July 29, 2026 14:21
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds Flow and TypeScript implementations of DropdownMenu and MenuToggle. The components support keyboard controls, outside interaction handling, focus restoration, accessibility props, Tether positioning, public exports, typed stories, and typed tests.

Changes

Dropdown menu feature

Layer / File(s) Summary
Component contracts and toggle
src/components/dropdown-menu/DropdownMenu.*, src/components/dropdown-menu/MenuToggle.*
Defines typed DropdownMenu props and state. Adds MenuToggle with caret rendering and styling.
Interaction and lifecycle handling
src/components/dropdown-menu/DropdownMenu.*
Adds open and close transitions, keyboard controls, global dismissal listeners, callbacks, and focus restoration.
Rendering and positioning
src/components/dropdown-menu/DropdownMenu.*
Validates two children, injects accessibility and event props, conditionally renders the menu, and configures Tether positioning.
Public wiring and typed stories
src/components/dropdown-menu/index.*, src/components/index.ts, src/components/dropdown-menu/DropdownMenu.stories.tsx
Adds Flow and TypeScript barrel exports. Updates stories with typed handlers, links, and button types.
Typed interaction tests
src/components/dropdown-menu/__tests__/*
Updates instance access, event construction, test props, body-mounting helpers, and Enzyme imports for TypeScript compatibility.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TriggerButton
  participant DropdownMenu
  participant Document
  participant Tether
  participant Menu
  TriggerButton->>DropdownMenu: click or keyboard input
  DropdownMenu->>Document: register dismissal listeners
  DropdownMenu->>Tether: render positioned menu
  Tether->>Menu: mount menu content
  Document->>DropdownMenu: outside interaction
  DropdownMenu->>Menu: close menu
  DropdownMenu->>TriggerButton: restore focus
Loading

Possibly related PRs

Suggested reviewers: jpan-box, reneshen0328, tjiang-box

Poem

A rabbit typed the menu with care,
Keys open it anywhere.
Clicks dismiss, and focus returns,
Tether keeps its place.
The caret dips with cheer.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the migration of DropdownMenu from Flow to TypeScript.
Description check ✅ Passed The description explains the migration scope, compatibility files, exports, and reported validation results.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/dropdown-menu/__tests__/DropdownMenu.test.tsx`:
- Around line 638-640: Fix the malformed test.each title in the “should not call
handleMenuClose() when event target is within the $description” case by removing
the stray opening template-literal/parenthesis characters and ensuring the title
has balanced delimiters. Keep the existing parameterized test and its behavior
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e42d001c-9098-4050-9df6-3b0799bf3f85

📥 Commits

Reviewing files that changed from the base of the PR and between 411145c and a6e15b8.

⛔ Files ignored due to path filters (1)
  • src/components/dropdown-menu/__tests__/__snapshots__/MenuToggle.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • src/components/dropdown-menu/DropdownMenu.js.flow
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/DropdownMenu.tsx
  • src/components/dropdown-menu/MenuToggle.js.flow
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/dropdown-menu/__tests__/DropdownMenu.test.tsx
  • src/components/dropdown-menu/__tests__/MenuToggle.test.tsx
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/index.ts
  • src/components/index.ts

Comment thread src/components/dropdown-menu/__tests__/DropdownMenu.test.tsx
@bonchevskyi
bonchevskyi force-pushed the refactor/flow-to-ts-dropdown-menu branch from a6e15b8 to ba13361 Compare July 30, 2026 10:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/components/dropdown-menu/DropdownMenu.tsx (3)

160-163: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Mark the unused positional param.

isKeyboardEvent is required positionally by Menu's onClose contract but unused here; prefixing with _ (or adding a short comment) prevents future no-unused-vars churn.

♻️ Suggested change
-    handleMenuClose = (isKeyboardEvent: boolean, event: React.SyntheticEvent | MouseEvent) => {
+    // eslint-disable-next-line `@typescript-eslint/no-unused-vars` -- positional param required by Menu's onClose signature
+    handleMenuClose = (_isKeyboardEvent: boolean, event: React.SyntheticEvent | MouseEvent) => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dropdown-menu/DropdownMenu.tsx` around lines 160 - 163, Rename
the unused positional parameter in handleMenuClose to use the project’s
underscore convention, while preserving its position for Menu’s onClose contract
and leaving the existing closeMenu and focusButton behavior unchanged.

56-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Annotate state explicitly.

state = { initialFocusIndex: null, isOpen: false } infers initialFocusIndex: null, so reads of this.state.initialFocusIndex are typed null rather than number | null. Annotating keeps the declared state contract authoritative.

♻️ Suggested change
-    state = {
+    state: DropdownMenuState = {
         initialFocusIndex: null,
         isOpen: false,
     };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dropdown-menu/DropdownMenu.tsx` around lines 56 - 59, Annotate
the state property in the DropdownMenu component with its intended state type so
initialFocusIndex is declared as number | null rather than inferred as only
null, while preserving isOpen as a boolean and keeping the existing initial
values.

198-217: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

The blanket cast hides a real runtime hazard.

React.Children.toArray can yield strings, numbers, and fragments, but the assertion to React.ReactElement<Record<string, unknown>>[] tells the compiler they're all elements. With <DropdownMenu>text<Menu /></DropdownMenu>, the length check passes and Line 215 dereferences .props on a string → TypeError instead of the intended contract error. Validating with React.isValidElement keeps the type narrowing honest and makes the failure mode match the existing error message.

♻️ Proposed narrowing
-        const elements = React.Children.toArray(children) as React.ReactElement<Record<string, unknown>>[];
+        const elements = React.Children.toArray(children).filter(
+            (child): child is React.ReactElement<Record<string, unknown>> => React.isValidElement(child),
+        );
 
         if (elements.length !== 2) {
             throw new Error('DropdownMenu must have exactly two children: A button component and a <Menu>');
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dropdown-menu/DropdownMenu.tsx` around lines 198 - 217,
Replace the blanket cast in the DropdownMenu child-processing logic with
validation using React.isValidElement for both children before accessing
menuButton.props or menu.props. Reject any non-element child with the existing
“exactly two children” contract error, while preserving the current handling for
two valid elements.
src/components/dropdown-menu/DropdownMenu.js.flow (1)

182-291: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the Flow shim declaration-only.

DropdownMenu.js.flow duplicates the entire implementation from DropdownMenu.tsx; conversion shims should expose only type declarations, e.g. declare export default class DropdownMenu..., so Flow consumers don’t type-check against a copy that can drift.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dropdown-menu/DropdownMenu.js.flow` around lines 182 - 291,
Replace the duplicated render implementation in DropdownMenu.js.flow with a
declaration-only Flow shim for the DropdownMenu class, exposing its public type
contract through a declare export default class declaration. Remove the copied
render logic and reference the existing DropdownMenu.tsx implementation as the
source of behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/dropdown-menu/DropdownMenu.tsx`:
- Around line 13-28: Realign the prop JSDoc comments in
src/components/dropdown-menu/DropdownMenu.tsx lines 13-28 and
src/components/dropdown-menu/DropdownMenu.js.flow lines 14-25: place the
scroll-parent, visible-window, and right-align descriptions on
constrainToScrollParent, constrainToWindow, and isRightAligned respectively, and
remove or attach the stray menu-open description to onMenuOpen. Keep both files’
documentation identical.

---

Nitpick comments:
In `@src/components/dropdown-menu/DropdownMenu.js.flow`:
- Around line 182-291: Replace the duplicated render implementation in
DropdownMenu.js.flow with a declaration-only Flow shim for the DropdownMenu
class, exposing its public type contract through a declare export default class
declaration. Remove the copied render logic and reference the existing
DropdownMenu.tsx implementation as the source of behavior.

In `@src/components/dropdown-menu/DropdownMenu.tsx`:
- Around line 160-163: Rename the unused positional parameter in handleMenuClose
to use the project’s underscore convention, while preserving its position for
Menu’s onClose contract and leaving the existing closeMenu and focusButton
behavior unchanged.
- Around line 56-59: Annotate the state property in the DropdownMenu component
with its intended state type so initialFocusIndex is declared as number | null
rather than inferred as only null, while preserving isOpen as a boolean and
keeping the existing initial values.
- Around line 198-217: Replace the blanket cast in the DropdownMenu
child-processing logic with validation using React.isValidElement for both
children before accessing menuButton.props or menu.props. Reject any non-element
child with the existing “exactly two children” contract error, while preserving
the current handling for two valid elements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 59fc3a5f-a42e-41d5-a498-c0fcd4e07826

📥 Commits

Reviewing files that changed from the base of the PR and between a6e15b8 and ba13361.

⛔ Files ignored due to path filters (1)
  • src/components/dropdown-menu/__tests__/__snapshots__/MenuToggle.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • src/components/dropdown-menu/DropdownMenu.js.flow
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/DropdownMenu.tsx
  • src/components/dropdown-menu/MenuToggle.js.flow
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/dropdown-menu/__tests__/DropdownMenu.test.tsx
  • src/components/dropdown-menu/__tests__/MenuToggle.test.tsx
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/index.ts
  • src/components/index.ts

Comment thread src/components/dropdown-menu/DropdownMenu.tsx
@bonchevskyi
bonchevskyi force-pushed the refactor/flow-to-ts-dropdown-menu branch from ba13361 to 7a7caf9 Compare July 31, 2026 13:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/dropdown-menu/MenuToggle.js.flow`:
- Around line 8-12: Rename the private Props type in MenuToggle.js.flow to
exported MenuToggleProps, use MenuToggleProps for the MenuToggle component
annotation, and re-export MenuToggleProps from the dropdown-menu Flow barrel
index.js.flow to match the TypeScript public API.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eec89f4b-5b2e-444f-ac3b-2d9f3171331c

📥 Commits

Reviewing files that changed from the base of the PR and between ba13361 and 7a7caf9.

⛔ Files ignored due to path filters (1)
  • src/components/dropdown-menu/__tests__/__snapshots__/MenuToggle.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • src/components/dropdown-menu/DropdownMenu.js.flow
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/DropdownMenu.tsx
  • src/components/dropdown-menu/MenuToggle.js.flow
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/dropdown-menu/__tests__/DropdownMenu.test.tsx
  • src/components/dropdown-menu/__tests__/MenuToggle.test.tsx
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/index.ts
  • src/components/index.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/components/dropdown-menu/tests/MenuToggle.test.tsx
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/dropdown-menu/index.ts
  • src/components/index.ts
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/DropdownMenu.tsx
  • src/components/dropdown-menu/tests/DropdownMenu.test.tsx
  • src/components/dropdown-menu/DropdownMenu.js.flow

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/dropdown-menu/MenuToggle.js.flow`:
- Around line 8-12: Rename the private Props type in MenuToggle.js.flow to
exported MenuToggleProps, use MenuToggleProps for the MenuToggle component
annotation, and re-export MenuToggleProps from the dropdown-menu Flow barrel
index.js.flow to match the TypeScript public API.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eec89f4b-5b2e-444f-ac3b-2d9f3171331c

📥 Commits

Reviewing files that changed from the base of the PR and between ba13361 and 7a7caf9.

⛔ Files ignored due to path filters (1)
  • src/components/dropdown-menu/__tests__/__snapshots__/MenuToggle.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • src/components/dropdown-menu/DropdownMenu.js.flow
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/DropdownMenu.tsx
  • src/components/dropdown-menu/MenuToggle.js.flow
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/dropdown-menu/__tests__/DropdownMenu.test.tsx
  • src/components/dropdown-menu/__tests__/MenuToggle.test.tsx
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/index.ts
  • src/components/index.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/components/dropdown-menu/tests/MenuToggle.test.tsx
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/dropdown-menu/index.ts
  • src/components/index.ts
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/DropdownMenu.tsx
  • src/components/dropdown-menu/tests/DropdownMenu.test.tsx
  • src/components/dropdown-menu/DropdownMenu.js.flow
🛑 Comments failed to post (1)
src/components/dropdown-menu/MenuToggle.js.flow (1)

8-12: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

rg -n -C 3 'MenuToggleProps|MenuToggle' src --glob '*.js.flow' --glob '*.ts' --glob '*.tsx'

Repository: box/box-ui-elements

Length of output: 9366


Export the Flow prop type to keep the public API aligned.

src/components/dropdown-menu/index.ts exposes MenuToggleProps, but src/components/dropdown-menu/MenuToggle.js.flow keeps the type private and does not re-export it from src/components/dropdown-menu/index.js.flow. Rename this type to MenuToggleProps, export it, use it for MenuToggle, and re-export it from the Flow barrel so Flow consumers match the TypeScript API.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dropdown-menu/MenuToggle.js.flow` around lines 8 - 12, Rename
the private Props type in MenuToggle.js.flow to exported MenuToggleProps, use
MenuToggleProps for the MenuToggle component annotation, and re-export
MenuToggleProps from the dropdown-menu Flow barrel index.js.flow to match the
TypeScript public API.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/components/dropdown-menu/DropdownMenu.tsx (1)

13-28: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

JSDoc comments remain off by one prop.

This issue is still present from a previous review. The doc comment above className (line 13) describes constrainToScrollParent. The comment above constrainToScrollParent (line 15) describes constrainToWindow. The comment above constrainToWindow (line 17) describes isRightAligned. The comment above isRightAligned (line 23, "Function called when menu is opened") is a stray leftover that belongs to onMenuOpen.

📝 Proposed fix to realign the JSDoc comments
 export interface DropdownMenuProps {
     bodyElement?: HTMLElement;
     children: React.ReactNode;
-    /** Forces menu to render within the scroll parent */
     className?: string;
+    /** Forces menu to render within the scroll parent */
     constrainToScrollParent: boolean;
-    /** Forces menu to render within the visible window */
+    /** Forces menu to render within the visible window */
     constrainToWindow: boolean;
-    /** Right aligns menu to button */
     constrainToWindowWithPin?: boolean;
     /** Enables responsive behaviors for this component */
     isResponsive?: boolean;
-    /** Function called when menu is opened */
+    /** Right aligns menu to button */
     isRightAligned: boolean;
     /** Handler for dropdown menu close events */
     onMenuClose?: (event: React.SyntheticEvent | MouseEvent) => void;
     /** Handler for dropdown menu open events */
     onMenuOpen?: () => void;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dropdown-menu/DropdownMenu.tsx` around lines 13 - 28, Realign
the JSDoc comments in the DropdownMenu props declaration so each description
documents its corresponding prop: document className as the CSS class,
constrainToScrollParent as scroll-parent rendering, constrainToWindow as
visible-window alignment, and isRightAligned as right alignment. Remove the
stray function-description comment above isRightAligned and ensure the
onMenuOpen callback retains the menu-open handler documentation.
🧹 Nitpick comments (1)
src/components/dropdown-menu/DropdownMenu.tsx (1)

12-12: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Type children as a two-element tuple to enforce the contract at compile time.

children: React.ReactNode allows strings, fragments, and arrays, while the two-child requirement is only checked at runtime. The cast after React.Children.toArray(children) also bypasses type checking. Type children as [React.ReactElement, React.ReactElement] instead and destructure it directly.

src/components/dropdown-menu/DropdownMenu.tsx:12

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/dropdown-menu/DropdownMenu.tsx` at line 12, Update the
DropdownMenu component’s children prop from React.ReactNode to
[React.ReactElement, React.ReactElement], then destructure the tuple directly
instead of converting with React.Children.toArray or casting. Preserve the
existing two-child rendering behavior while enforcing the contract at compile
time.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/components/dropdown-menu/DropdownMenu.tsx`:
- Around line 13-28: Realign the JSDoc comments in the DropdownMenu props
declaration so each description documents its corresponding prop: document
className as the CSS class, constrainToScrollParent as scroll-parent rendering,
constrainToWindow as visible-window alignment, and isRightAligned as right
alignment. Remove the stray function-description comment above isRightAligned
and ensure the onMenuOpen callback retains the menu-open handler documentation.

---

Nitpick comments:
In `@src/components/dropdown-menu/DropdownMenu.tsx`:
- Line 12: Update the DropdownMenu component’s children prop from
React.ReactNode to [React.ReactElement, React.ReactElement], then destructure
the tuple directly instead of converting with React.Children.toArray or casting.
Preserve the existing two-child rendering behavior while enforcing the contract
at compile time.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f3e42533-5583-4afd-891f-6f98f9aea8d9

📥 Commits

Reviewing files that changed from the base of the PR and between 7a7caf9 and 8502500.

⛔ Files ignored due to path filters (1)
  • src/components/dropdown-menu/__tests__/__snapshots__/MenuToggle.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • src/components/dropdown-menu/DropdownMenu.js.flow
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/DropdownMenu.tsx
  • src/components/dropdown-menu/MenuToggle.js.flow
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/dropdown-menu/__tests__/DropdownMenu.test.tsx
  • src/components/dropdown-menu/__tests__/MenuToggle.test.tsx
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/index.ts
  • src/components/index.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • src/components/dropdown-menu/tests/MenuToggle.test.tsx
  • src/components/dropdown-menu/MenuToggle.tsx
  • src/components/index.ts
  • src/components/dropdown-menu/index.js.flow
  • src/components/dropdown-menu/MenuToggle.js.flow
  • src/components/dropdown-menu/DropdownMenu.js.flow
  • src/components/dropdown-menu/DropdownMenu.stories.tsx
  • src/components/dropdown-menu/tests/DropdownMenu.test.tsx
  • src/components/dropdown-menu/index.ts

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.

1 participant