Proposal - introduce Navigation component
burakukula opened this issue · comments
Discussed in https://github.com/contentful/forma-36/discussions/1160
Originally posted by thebesson August 6, 2021
The problem
Currently Tabs
component is responsible for implementing both "Tabs" and "Navigation" patterns. This adds complexity to the implementation and makes implementing a11y patterns challenging. See:
The proposed solution
I propose to separate the logic into two components.
- Remove all logic for navigation in the
Tabs
component: tabs are buttons, not links. - Introduce a new component
Navigation
orNavigationPanel
withNavigationTab
orNavigationItem
, which will implementnav
tag with links, and the forma-36 styling, without additional logic. - Add conventional keyboard navigation pattern for
Tabs
: https://www.w3.org/TR/wai-aria-practices-1.1/#tabpanel
Navigation
<Navigation` variant=''horizontal-divider">
<NavigationItem href="https://some.link">Some link</NavigationItem>
<NavigationItem href="https://some.link">Some link</NavigationItem>
</Navigation>
before
<Tabs role="tablist">...</Tabs>
<Tabs role="navigation">...</Tabs>
after
<Tabs>...</Tabs>
<Navigation>...</Navigation>
Breaking changes
v4