You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ui-core-components: Button silently drops a bare onFocus prop #30811
Passing onFocus to core Button has no effect — the handler never fires. Confirmed empirically during the antd Button migration (#30809).
Core Button is built on react-aria, which routes focus through its own useFocusable/focusProps rather than spreading a bare onFocus onto the DOM node, so the prop is accepted by the type (via ButtonHTMLAttributes) but silently discarded at runtime — the worst combination: it typechecks and does nothing.
Broke MetaPilot focus tracking in 4 files during the migration; worked around there with a wrapping <span onFocus>, which is a smell that belongs in the component instead.
Suggested fix: wire onFocus/onBlur through react-aria's focus props (or document them as unsupported and fail the type). Same shape of issue as #30803 — a react-aria behavior that silently diverges from the plain-DOM expectation consumers carry over from antd.
Status (2026-10-16)
Not reproducible on main. Core Button (components/base/buttons/button.tsx) passes the remaining props, including onFocus/onBlur, to react-aria's Button/Link, which support them. That spread has not changed since the library landed (#26035), and react-aria-components has been on ^1.16.0 since March, so there is no PR that "fixed" it. The original report most likely came from a different cause (Collate MetaPilot code or a test mock). No <span onFocus> workaround exists in OSS.
Verified with vitest: onFocus/onBlur fire on keyboard focus in/out, and onFocus fires on the link variant. Both cases fail when button.tsx is changed to drop the handlers.
Regression tests land in #35509 (button.test.tsx), which closes this issue.
Activity