TabPanel: support manual tab activation#46004
Conversation
|
|
|
@jasmussen and @jameskoster , this may require design feedback as I don't think that |
ab29098 to
7c5b61a
Compare
ntsekouras
left a comment
There was a problem hiding this comment.
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 |
alexstine
left a comment
There was a problem hiding this comment.
@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.
tyxla
left a comment
There was a problem hiding this comment.
This is looking great, there's not much to add to what has been suggested in prior review already. 🚀
|
|
||
| const getSelectedTab = () => screen.getByRole( 'tab', { selected: true } ); | ||
|
|
||
| const originalGetClientRects = window.HTMLElement.prototype.getClientRects; |
There was a problem hiding this comment.
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().
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). |
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
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
TabPanelcomponent (see #45390 and W3C docs for more info)Why?
New feature for the
TabPanelcomponent, for enhanced accessibility when necessary.How?
hasManualTabActivation(name TBD)Testing Instructions
TabPanelexample in StorybookhasManualTabActivationprop totrueScreenshots or screencast
Kapture.2022-11-23.at.13.50.08.mp4