Skip to content

fix: re-export FocusableElement, HoverEvent and KeyboardEvent types from react-aria-components - #10366

Merged
LFDanLu merged 3 commits into
adobe:mainfrom
sobol-sudo:fix/rac-reexport-shared-event-types
Aug 10, 2026
Merged

LFDanLu merged 3 commits into
adobe:mainfrom
sobol-sudo:fix/rac-reexport-shared-event-types

Conversation

@sobol-sudo

Copy link
Copy Markdown
Contributor

Closes #10166.

react-aria-components re-exports a curated subset of @react-types/shared, but three types that show up structurally in the public ButtonProps aren't in that list: FocusableElement, HoverEvent and KeyboardEvent. Since @react-types/shared is only a transitive dependency for consumers, TypeScript can't write a portable import for those names when it emits declarations, so a project using composite + declaration that wraps Button or exports a type inferred from ButtonProps fails with TS2883.

The chain is ButtonProps → AriaButtonProps → PressEvents/FocusableProps: onClick is typed MouseEvent<FocusableElement>, onKeyDown/onKeyUp take the shared KeyboardEvent alias, and HoverEvents brings in HoverEvent. The Omit<> on ButtonProps doesn't strip any of them.

This adds the three names to the existing @react-types/shared re-export block, and to exports/Button.ts, which is a published subpath that already re-exports PressEvent from the same module and hits the same error. It deliberately doesn't blanket re-export everything from @react-types/shared, per @LFDanLu's note on the issue. Same shape as #9955.

I also added four assertions to the existing test/types.tsx so these stay nameable from the package root. Three of them fail on main with TS2694; the fourth is PressEvent, which already works and is there as a control so the whole event-type group is covered rather than just the new names.

react-aria has the same gap — it exports HoverEvent and KeyboardEvents but not KeyboardEvent or FocusableElement. Happy to do that as a follow-up if you want it.

@github-actions github-actions Bot added the RAC label Jul 25, 2026
snowystinger
snowystinger previously approved these changes Jul 28, 2026
LFDanLu
LFDanLu previously approved these changes Aug 7, 2026
@snowystinger
snowystinger dismissed stale reviews from LFDanLu and themself via 66b8bf7 August 10, 2026 00:16
@snowystinger snowystinger added the no testing Does not require manual testing during testing session label Aug 10, 2026
@LFDanLu
LFDanLu added this pull request to the merge queue Aug 10, 2026
Merged via the queue into adobe:main with commit 7c07654 Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no testing Does not require manual testing during testing session RAC ready for review small review Easy to review PR typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

react-aria-components: ButtonProps exposes @react-types/shared types not re-exported, causing TS2883 in composite/project-reference builds

3 participants