design-system-react icon indicating copy to clipboard operation
design-system-react copied to clipboard

Tabs [21]

Open kwilloughby opened this issue 10 years ago • 6 comments

I'm working on a project that will be delivered in 06 and it requires tabs. image The SLDS component can be found at https://latest-204.lightningdesignsystem.com/components/tabs.

@jamin-hall

kwilloughby avatar Jul 06 '16 22:07 kwilloughby

Heya @kwilloughby in an effort to get exactly what you need created faster, I propose we put only exactly what you're after into place first, and iterate on that.

Which of these do you need first?

  • [ ] Default
  • [ ] Default - Overflowing items
  • [ ] Default - With Nested Scoped Tabs
  • [ ] Scoped
  • [ ] Scrolling
  • [ ] Scrolling - Scoped

Default

screenshot 2016-08-23 11 28 57

Default - Overflowing items

screenshot 2016-08-23 11 31 59

Default - With Nested Scoped Tabs

screenshot 2016-08-23 11 32 25

Scoped

screenshot 2016-08-23 11 32 31

Scrolling

screenshot 2016-08-23 11 32 48

Scrolling - Scoped

screenshot 2016-08-23 11 33 09

chriscorwin avatar Aug 23 '16 15:08 chriscorwin

I agree. We need "Default" (the 1st one) for the specific project I'm working on.

kwilloughby avatar Aug 23 '16 15:08 kwilloughby

On it.

chriscorwin avatar Aug 23 '16 15:08 chriscorwin

@pixelprodotco, Chris Corwin is working on the tabs control. Just wanted to provide an update.

kwilloughby avatar Aug 24 '16 18:08 kwilloughby

@chriscorwin

Scope of tabs

  • Allow app dev to make array of tabsItems that can be be created by app and passed in as children.
<Tabs id="mom" {...props}>
    <TabItem active label="One">Tab One panel contents</TabItem>
    <TabItem label="Two">Tab Two panel contents</TabItem>
</Tabs>
  • TabItem should accept an href since this is navigation, but it will be prevented if onClick is present.
  • Allow active tab to be set by parent component
  • onClick should pass out an event and an object with { href: props.href } or maybe all the props of the TabItem so devs could pass an id back to themselves?
  • component should be controlled/stateless (fat arrow, pure function)
  • component should accept className
  • each TabItem should accept className
  • label should accept string or a node (to allow for tooltips)
  • all props should have a test associated with them

if you have time:

  • component should have a scoped prop that is a boolean (we might want to have an example of scoped inside non-scoped in the storybook, if it's easy)

Future features:

  • overflow (pass in length prop)
  • scrolling ( we might introduce state for this, not sure yet)

Accessibility stuff:

  • Tabs should have an application-like ARIA role or tablist and function like a tablist. Details: https://www.w3.org/TR/wai-aria/roles#tablist This means id probably needs to be required to associate tabs and panels (feel free to suffix with __panel or something.
  • working example: http://accessibility.athena-ict.com/aria/examples/tabpanel2.shtml
  • if this is a controlled component, then we'd need something like an onChange callback to tell the app which one is selected and then change focus.

interactivellama avatar Aug 26 '16 16:08 interactivellama

@chriscorwin I think I've made a mistake in my scope above. With tree for instance you shouldn't be able to tab between the nodes. You probably shouldn't here either. It should be left/right or with the mouse. More like this example: http://a11y.nicolas-hoffmann.net/tabs/#robust_accessible

Tab - only the active tab is in the tab order

from https://www.w3.org/TR/2013/WD-wai-aria-practices-20130307/#tabpanel It looks like you are discovered this though, so no change needed to your PR for this mistake by me.

Although, even that link is a working draft I believe.

interactivellama avatar Sep 02 '16 15:09 interactivellama