-
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
: support manual tab activation
#46004
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
@jasmussen and @jameskoster , this may require design feedback as I don't think that |
ab29098
to
7c5b61a
Compare
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.
Thanks for the PR Marco! We just need to take a look at the non-active but focused styles, as you already mention. Other than that this looks good.
It's working for me: tabpanel.mp4I don't have a great idea for the name either, but perhaps something that relates more to the states involved; |
On a similar note, |
We can probably consider this when we get to #41904. |
One thing that's occurring to me is that
So we'd eventually end up managing the That's doable, of course, but maybe it'd be more readable in the long run if we went (as @ciampo suggests) with the same |
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.
@ciampo Thanks for getting this done quickly. Hopefully, once this is merged, other PRs can progress and further enhancements can be made to code already in trunk.
Giving the PR an approval while the last few bits of feedback are addressed. I agree using the same prop name as we'll have in Ariakit could be useful.
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.
This is looking great, there's not much to add to what has been suggested in prior review already. 🚀
@@ -34,7 +34,23 @@ const TABS = [ | |||
|
|||
const getSelectedTab = () => screen.getByRole( 'tab', { selected: true } ); | |||
|
|||
const originalGetClientRects = window.HTMLElement.prototype.getClientRects; |
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.
Nit: should this be declared right before we override it in beforeAll
? This would then be a let
and we'd just set it in beforeAll()
.
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.
Done in 3128c26
7c5b61a
to
8ef6ea4
Compare
I renamed the prop to I guess the last thing to decide is whether we're ok to merge this PR with the current way tabs look in manual activation mode, when they are focused but not active (see video in the description). |
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 great 🚀
Co-authored-by: Marin Atanasov <[email protected]>
Given the absence of strong feedback against merging, I'll go ahead and merge this PR once CI is ✅ . As @jameskoster mentioned above:
|
Closes #45390
What?
Adds support for manual tab activation to the
TabPanel
component (see #45390 and W3C docs for more info)Why?
New feature for the
TabPanel
component, for enhanced accessibility when necessary.How?
hasManualTabActivation
(name TBD)Testing Instructions
TabPanel
example in StorybookhasManualTabActivation
prop totrue
Screenshots or screencast
Kapture.2022-11-23.at.13.50.08.mp4