-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TabPanel: Convert to TypeScript #43536
Conversation
@@ -145,7 +145,6 @@ Optionally provide a tab name for a tab to be selected upon mounting of componen | |||
#### children | |||
|
|||
A function which renders the tabviews given the selected tab. The function is passed the active tab object as an argument as defined the tabs prop. | |||
The element to which the tooltip should anchor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like copypasta 🧹
title: 'Components/TabPanel', | ||
component: TabPanel, | ||
parameters: { | ||
controls: { expanded: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't expand the code snippet because it isn't very helpful if the children
part isn't shown
Size Change: +11 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat 🚀
); | ||
} | ||
}, [ tabs ] ); | ||
|
||
return ( | ||
<div className={ className }> | ||
<NavigableMenu | ||
ref={ forwardedRef } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious to why the ref
was added to NavigableMenu
and not the wrapper div ?
I'm asking because I wonder if consumers of the package would have a way to expect, in general, what component the ref
holds (since we don't even document it in our docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I'm pretty unclear about ref forwarding. Most examples I find online are cases where you want to do myRef.focus()
. So I kind of understood it to mean that you want to pass the ref to the main interactive element 🤔 But I really don't know. Should make a non-ref-forwarding version of WordPressComponent
asap? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I'm pretty unclear about ref forwarding
Same — not sure if there's a standard around it. We should probably read about in order to make a better informed decision!
Should make a non-ref-forwarding version of WordPressComponent asap? 😅
That sounds like a good option for now. We could then avoid introducing a ref
in this PR altogether, and then swap the custom instances of WordPressComponentPropsWithoutRef
across the package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposed in #43611
8d968fc
to
de963ba
Compare
de963ba
to
f1710c7
Compare
Part of #35744
In preparation for #42320
What?
Converts the TabPanel component to TypeScript.
Why?
For better documentation, devex, and code quality.
How?
Following the contributing guide.
Testing Instructions
npm run storybook:dev