-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat(tabs): add new tabs components #2002
Conversation
Preview is ready. |
Visual Tests Report is ready. |
All this changes for tabs? |
@sofiushko Hey! Could you rebase your branch? |
cb3e9d8
to
4921035
Compare
Done |
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.
There is a w3c design pattern for tabs. For now there are some differences between this pattern and current code behaviour:
Enter
key doesn't activate tab- Arrows don't move focus within tabs
- I'm not quite sure about moving focus between tabs by
Tab
key pressing
src/components/tabs/TabProvider.tsx
Outdated
import {TabContext} from './contexts/TabContext'; | ||
|
||
export type TabProviderProps = React.PropsWithChildren<{ | ||
value: string | undefined; |
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.
Why not value?: string
?
src/components/tabs/TabList.scss
Outdated
} | ||
} | ||
|
||
&-title { |
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.
There is one &-title
above, do we actually need to repeat it here?
|
||
return ( | ||
<div | ||
{...filterDOMProps(props, {labelable: 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.
Is it assumed that users always should set aria-labelledby
by themselves?
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.
Yes, like aria-controls
for tab
It because components Tab
and TabPanel
can be add by users separately.
I can generate id and ARIA attrs, but there is no guarantee that panel will match tab with the id and ARIA attributes will conform to valid values
I relied on gravity-ui/rfc#16
It`s ok, we can do this
it`s not ok. If we want this behaviour, we need to make tabs component uncontrolled. It goes against the issue. Maybe we should change the interface to make it possible?
I repeated the current component in this moment |
@sofiushko I agree that focus behaviour should follow w3c pattern (arrow keys navigation instead of tabs). But I don't understand why we should change the API to make it possible |
So sorry |
Add some behaviour from w3c design pattern for tabs
|
No description provided.