Skip to content

[navigation menu] Correct mismatched ForwardedRef types - #3775

Merged
atomiks merged 2 commits into
mui:masterfrom
CrawlerCode:fix/mismatched-forwardedref-types
Jan 19, 2026
Merged

atomiks merged 2 commits into
mui:masterfrom
CrawlerCode:fix/mismatched-forwardedref-types

Conversation

@CrawlerCode

@CrawlerCode CrawlerCode commented Jan 16, 2026 •

Copy link
Copy Markdown
Contributor

The ForwardedRef<...> type of NavigationMenuList, NavigationMenuItem, and NavigationMenuIcon does not match the tag used in useRenderElement function.

This results in the following error, for example:
Type 'HTMLDivElement' is missing the following properties from type 'HTMLUListElement': compact, type

Fixes #3784

@pkg-pr-new

pkg-pr-new Bot commented Jan 16, 2026 •

Copy link
Copy Markdown
  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@3775
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@3775
    

commit: 143a8b7

@greptile-apps

greptile-apps Bot commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixed type mismatches where ForwardedRef types didn't align with the actual HTML elements rendered by useRenderElement.

  • NavigationMenuIcon: HTMLDivElement → HTMLSpanElement (renders <span>)
  • NavigationMenuItem: HTMLDivElement → HTMLLIElement (renders <li>)
  • NavigationMenuList: HTMLDivElement → HTMLUListElement (renders <ul>)

This resolves TypeScript errors where, for example, HTMLDivElement was missing properties from HTMLUListElement like compact and type.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are straightforward type corrections that fix legitimate TypeScript errors. Each change aligns the ForwardedRef generic type with the actual HTML element being rendered, which is verifiable by inspecting the useRenderElement calls in each file. No logic changes, no behavioral changes—purely type safety improvements.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/navigation-menu/icon/NavigationMenuIcon.tsx Corrected ForwardedRef type from HTMLDivElement to HTMLSpanElement to match the 'span' tag used in useRenderElement
packages/react/src/navigation-menu/item/NavigationMenuItem.tsx Corrected ForwardedRef type from HTMLDivElement to HTMLLIElement to match the 'li' tag used in useRenderElement
packages/react/src/navigation-menu/list/NavigationMenuList.tsx Corrected ForwardedRef type from HTMLDivElement to HTMLUListElement to match the 'ul' tag used in useRenderElement

@greptile-apps

greptile-apps Bot commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@mui-bot

mui-bot commented Jan 16, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jan 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 143a8b7
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/696de2b4e5cf1300079d8ad6
😎 Deploy Preview https://deploy-preview-3775--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

stevezhu added a commit to stevezhu/nulltab that referenced this pull request Jan 17, 2026
@atomiks atomiks added type: bug It doesn't behave as expected. component: navigation menu Changes related to the navigation menu component. labels Jan 19, 2026

@atomiks atomiks 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.

Thanks for the fix - can you run pnpm docs:api?

@atomiks

atomiks commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

Never mind, the generated tests were referring to deduplication, not docs (+ the other tests are flaking and are unrelated to these changes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: navigation menu Changes related to the navigation menu component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NavigationMenu mismatched ref types

3 participants