Skip to content

Published @react-types broken for Menu component #5818

@jaens

Description

@jaens

Provide a general summary of the issue here

The react-aria-components published version 1.0.1 Menu implementation (which I assume derives from @react-aria/menu) is out of sync with the published types in @react-types/menu.

🤔 Expected Behavior?

autoFocus works.

😯 Current Behavior

Published component uses the autoFocus property to set initial focus.
@react-types/menu version 3.9.6 does not declare this property... TypeScript fails to compile.
If you override the TS error it works.

Note that @react-aria/menu is version 3.12.0, which I assume r-a-c uses.

The type as currently declared is:

export interface MenuProps<T> extends CollectionBase<T>, MultipleSelection {
  /** Where the focus should be set. */
  isOpen?: boolean | FocusStrategy,
  ...

Looks like isOpen got renamed to autoFocus at some point.

💁 Possible Solution

Re-publish @react-types/menu?

Seems like having separate @react-types packages is quite error prone, it would make more sense to provide types with the main packages (ie. @react-aria/menu), like 90% of other TypeScript projects?

🔦 Context

No response

🖥️ Steps to Reproduce

Install latest react-aria-components and @react-aria/menu.

Add following TS code somewhere:

import { Menu } from "react-aria-components";

<Menu autoFocus="first" />

Version

react-aria-components 1.0.1

What browsers are you seeing the problem on?

Other

If other, please specify.

No response

What operating system are you using?

N/A

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions