Skip to content

<Tab> and <TabPanel> id type mismatch #8422

Open
@kidonng

Description

@kidonng

Provide a general summary of the issue here

<Tab id={value}> accepts Key (string and number) while <TabPanel id={value}> only accepts string.

🤔 Expected Behavior?

<Tab> type is defined as:

export interface TabProps extends RenderProps<TabRenderProps>, AriaLabelingProps, LinkDOMProps, HoverEvents {
/** The unique id of the tab. */
id?: Key,

I expect to be able to use number as id for <TabPanel> as well.

😯 Current Behavior

Trying to use number as id for <TabPanel> causes a type error:

Image

Due to <TabPanel> type defined as:

export interface DOMProps {
/**
* The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
*/
id?: string
}

💁 Possible Solution

export interface TabPanelProps extends AriaTabPanelProps, RenderProps<TabPanelRenderProps> {

  export interface TabPanelProps extends AriaTabPanelProps, RenderProps<TabPanelRenderProps> { 
+   /** The unique id of the tab. */
+   id?: Key,

🔦 Context

No response

🖥️ Steps to Reproduce

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wChRJY4BvOAFRQCMAaepgBRQDskAbOAL5xsuAkXQwAtCijAUktLkg8uMAM5lSirmvgwmauAF44AHgB8pONbMNGcYABMj1AIxCA9JZu2O3Pg7ObgLmph52nDy8lmGWQA

Version

[email protected]

What browsers are you seeing the problem on?

Other

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions