Skip to content

Conversation

solonaarmstrong-zz
Copy link

@solonaarmstrong-zz solonaarmstrong-zz commented Jan 17, 2019

WHY are these changes introduced?

Resolves #583

WHAT is this pull request doing?

Changes style guide examples so panel activates.

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import * as React from 'react';
import {Page, Tabs, Card} from '../src';

interface State {}

export default class Playground extends React.Component<{}, State> {
  state = {
    selected: 0,
  };

  handleTabChange = (selectedTabIndex) => {
    this.setState({selected: selectedTabIndex});
  };

  render() {
    const {selected} = this.state;
    const tabs = [
      {
        id: 'all-customers',
        content: 'All',
        accessibilityLabel: 'All customers',
        panelID: 'all-customers-content',
      },
      {
        id: 'accepts-marketing',
        content: 'Accepts marketing',
        panelID: 'accepts-marketing-content',
      },
      {
        id: 'repeat-customers',
        content: 'Repeat customers',
        panelID: 'repeat-customers-content',
      },
      {
        id: 'prospects',
        content: 'Prospects',
        panelID: 'prospects-content',
      },
    ];

    return (
      <Page title="Playground">
        <Card>
          <Tabs tabs={tabs} selected={selected} onSelect={this.handleTabChange}>
            <Card.Section title={tabs[selected].content}>
              <p>Tab {selected} selected</p>
            </Card.Section>
          </Tabs>
        </Card>
      </Page>
    );
  }
}

🎩 checklist

@solonaarmstrong-zz solonaarmstrong-zz added Accessibility Accessibility Needs design, development, or content work relating to accessibility. labels Jan 17, 2019
@BPScott BPScott temporarily deployed to polaris-react-pr-893 January 17, 2019 15:09 Inactive
Copy link

@dpersing dpersing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me and reads out the tabpanel role as expected when a screen reader user navigates into the panel. The connection between the selected tab and the panel is clearer!

@solonaarmstrong-zz solonaarmstrong-zz changed the title [Tabs] [Tabs] Accessibility Jan 17, 2019
Copy link
Contributor

@ry5n ry5n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@solonaarmstrong-zz solonaarmstrong-zz merged commit ad4b8bd into master Jan 17, 2019
@solonaarmstrong-zz solonaarmstrong-zz deleted the tabs-a11y branch January 17, 2019 21:14
@BPScott BPScott temporarily deployed to production January 28, 2019 16:33 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accessibility Needs design, development, or content work relating to accessibility.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants