Skip to content
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

Button and link a11y docs #924

Merged
merged 52 commits into from
Feb 19, 2019
Merged

Button and link a11y docs #924

merged 52 commits into from
Feb 19, 2019

Conversation

dpersing
Copy link
Contributor

This PR includes component-level accessibility information for the link and button components, to appear in the repo and in the style guide. Both pages are included because the button content refers to the link content.

WHY are these changes introduced?

Adds component-level documentation as part of the style guide accessibility documentation project. This content is added after the examples and props, before best practices.

WHAT is this pull request doing?

  • Adds new accessibility sections for the button and link components README.md files.
  • Adds an entry for the UNRELEASED.md file under Documentation.

How to 🎩

  1. Check out https://github.com/Shopify/polaris-styleguide/pull/2493 from polaris-styleguide to get the changes that support the accessibility section.
  2. In another Terminal tab or window, check out this branch from polaris-react and run the instructions for testing in a consuming project.
  3. In the polaris-styleguide tab, run dev up && dev start.
  4. View changes:

Screenshots

Do/Don't example

Do and Don't content displayed on the gray background

Keyboard content example

Keyboard example with access instructions and special content

Mobile-specific example

Android tab content

@BPScott BPScott temporarily deployed to polaris-react-pr-924 January 22, 2019 23:10 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-924 January 22, 2019 23:11 Inactive

## Accessibility

<!-- content-for: android -->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

iOS and Android content for the button page, since there are separate tabs. We don't currently have native-specific guidance so I've linked to the platform best practices.

Copy link
Contributor

Choose a reason for hiding this comment

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

Although it's a bit awkward from the "Web" perspective to begin the section with external resources that don't apply to web, my understanding is that this will eventually change, when we have native-specific guidance.

To make it more clear what content applies to the reader:

  • We could add an intro sentence under the Accessibility heading that lets readers know that the accessibility guidelines for the button component differ for Web, Android, and iOS. This sets the reader up to expect to look for the content that applies to them.

  • Perhaps rearrange the leading sentences to start with "For Android, see Material Design ... " and "For iOS, see Apple's ..."

  • Perhaps add Android, iOS, and Web headings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sadiesaurus The sections here display on the web, iOS, and Android tabs in the UI in the style guide, which is what the <! content-for: ...> tags are doing in the file. The Mobile-specific example screenshot is showing what would show up for Android on that tab, while the other specific content shows up for each tab specified. That's what the first item in the 🎩 recommendations is doing, pulling from the PR that @kaelig worked on to do this formatting. Let me know if that's clear!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohhhh, yes now I see. I didn't 🎩 it properly last time. This works well!

Please disregard my comment! 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that headings would help with the Markdown readability in GitHub itself. I couldn't find a solid and elegant way to make it work :/

@BPScott and I might have cycles to look into it later this year.

@dpersing
Copy link
Contributor Author

@kaelig, would particularly love any thoughts in relation to what you're tinkering with for formatting for this content.

@dpersing
Copy link
Contributor Author

dpersing commented Jan 23, 2019

Dropped a question about the heading hierarchy in the related style guide PR: https://github.com/Shopify/polaris-styleguide/pull/2493#issuecomment-456935369

Currently, the Accessibility heading is getting rendered as an <h3>, which is throwing off the section hierarchy.

Fixed!

@dpersing dpersing changed the title Button link a11y docs Button and link a11y docs Jan 23, 2019
Co-Authored-By: dpersing <devon.persing@shopify.com>
@BPScott BPScott temporarily deployed to polaris-react-pr-924 January 24, 2019 23:44 Inactive
Co-Authored-By: dpersing <devon.persing@shopify.com>
@BPScott BPScott temporarily deployed to polaris-react-pr-924 January 30, 2019 18:58 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-924 February 7, 2019 17:23 Inactive
Co-Authored-By: dpersing <devon.persing@shopify.com>
@BPScott BPScott temporarily deployed to polaris-react-pr-924 February 7, 2019 17:24 Inactive
Co-Authored-By: dpersing <devon.persing@shopify.com>
@BPScott BPScott temporarily deployed to polaris-react-pr-924 February 7, 2019 17:24 Inactive
@dpersing
Copy link
Contributor Author

dpersing commented Feb 7, 2019

@kaelig Can you take another gander?

@BPScott BPScott temporarily deployed to polaris-react-pr-924 February 7, 2019 21:10 Inactive
@BPScott BPScott temporarily deployed to polaris-react-pr-924 February 7, 2019 21:12 Inactive
- Use the `ariaControls` prop to add an `aria-controls` attribute to the button. Use the attribute to point to the unique `id` of the content that the button manages.
- If a button expands or collapses adjacent content, then use the `ariaExpanded` prop to add the `aria-expanded` attribute to the button. Set the value to convey the current expanded (`true`) or collapsed (`false`) state of the content.
- Use the `disabled` prop to set the `disabled` state of the button. This prevents merchants from being able to interact with the button, and conveys its inactive state to assistive technologies.
- Use the `ariaPressed` prop to add an `aria-pressed` attribute to the button. Use the `pressed` prop to add a pressed-style to the button as well.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to document use for ariaPressed and pressed: #984

Copy link
Contributor

@kaelig kaelig left a comment

Choose a reason for hiding this comment

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

:shipit:

UNRELEASED.md Outdated
- Added `Stack.Item` properties and description to [style guide](https://polaris.shopify.com)’s ([#772](https://github.com/Shopify/polaris-react/pull/772))
- Added accessibility documentation for the button and link components ([#924](https://github.com/Shopify/polaris-react/pull/924))
- Added accessibility documentation to the resource list and data table components ([#927](https://github.com/Shopify/polaris-react/pull/927))
- Added accessibility recommendations for the caption component ([#928](https://github.com/Shopify/polaris-react/pull/928/))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused as to why some of these unrelated entries are in this PR?

@dpersing dpersing merged commit f98a742 into master Feb 19, 2019
@BPScott BPScott requested a deployment to polaris-react-pr-924 February 19, 2019 18:02 Abandoned
solonaarmstrong-zz pushed a commit that referenced this pull request Feb 20, 2019
* Added accessibility section for the button component
* Added accessibility section for the link component
* Added entry for Unreleased.md
@kaelig kaelig deleted the button-link-a11y-docs branch February 21, 2019 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants