Skip to content

Conversation

@atomiks
Copy link
Contributor

@atomiks atomiks commented Dec 28, 2025

This loosens or restricts the type of the ref for some components

Some rules:

  • Non-button <div> elements should not be polymorphic (as in rendered as another tag, not replaced with a same-tag component), so these have strict HTMLDivElement
  • Button <div> elements (e.g. composite items) can be polymorphic (e.g. rendered as an anchor tag), so use HTMLElement
  • <Tooltip.Trigger> could be a non-HTML element (e.g. using SVG elements), so I've replaced instances of Element with HTMLElement where applicable, except for <Tooltip.Trigger>, where I made any stricter

This doesn't solve event.currentTarget typesafety in event handlers, yet. Also, some button components which are unlikely to be polymorphic (but technically allow it via nativeButton={false}) still use strict HTMLButtonElement instead of HTMLElement. Changing them to be looser could be ok, if worth it.

@atomiks atomiks added type: bug It doesn't behave as expected. typescript scope: all components Widespread work has an impact on almost all components. labels Dec 28, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 28, 2025

  • vite-css-base-ui-example

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

commit: 38158e3

@mui-bot
Copy link

mui-bot commented Dec 28, 2025

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
Copy link

netlify bot commented Dec 28, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 38158e3
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/695f34277d837f00075b7039
😎 Deploy Preview https://deploy-preview-3638--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.

@atomiks atomiks marked this pull request as ready for review December 29, 2025 04:24
@michaldudak
Copy link
Member

I'm wondering if we can/should enable non-HTML triggers for more components (think SVG buttons) as a follow-up (or if there's community demand). This would require adding a couple of conditions in focus management logic (as focus is not available in SVG elements).

@atomiks atomiks force-pushed the fix/forwarded-refs branch from fd03770 to 38158e3 Compare January 8, 2026 04:35
@atomiks atomiks merged commit c58873d into mui:master Jan 9, 2026
23 checks passed
@atomiks atomiks deleted the fix/forwarded-refs branch January 9, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: all components Widespread work has an impact on almost all components. type: bug It doesn't behave as expected. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants