@shopify/theme-a11y
A library of useful functions that help make your theme more accessible.
Last updated a month ago by shopify-dep .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @shopify/theme-a11y 
SYNC missed versions from official npm registry.

@shopify/theme-a11y

Getting Started

Theme Scripts can be used in any theme project. To take advantage of semantic versioning and easy updates, we recommend using NPM or Yarn to include them in your project:

yarn add @shopify/theme-a11y

and then import the functions you wish to use through ES6 imports:

import * as a11y from '@shopify/theme-a11y';

If you prefer not to use a package manager, you can download the latest version of Theme A11y and include it in your project manually from the following links:

These files make Theme A11y accessible via the Shopify.theme.a11y global variable.


Browser Support

Theme A11y uses a method not available in legacy browsers: Element.matches(). If you wish to support legacy browsers, make sure you add the following dependencies to your project:

yarn add element-matches

and then import them before you import Theme A11y:

// Only need to import these once
import 'element-matches';

// Import @shopify/theme-a11y anywhere you need it
import * as a11y from '@shopify/theme-a11y';

Methods

accessibleLinks(elements, options)

Add a descriptive message to external links and links that open to a new window.

  • elements - Specific elements to be targeted
  • options.messages - Custom messages object to overwrite with keys: newWindow, external, newWindowExternal
  • options.messages.newWindow - When the link opens in a new window (e.g. target="_blank")
  • options.messages.external - When the link is to a different host domain.
  • options.messages.newWindowExternal - When the link is to a different host domain and opens in a new window.
  • options.prefix - Prefix to namespace "id" of the messages

Current Tags

  • 1.0.0-alpha.1                                ...           alpha (3 years ago)
  • 3.1.0                                ...           latest (a month ago)

16 Versions

  • 3.1.0                                ...           a month ago
  • 3.0.3                                ...           8 months ago
  • 3.0.2                                ...           8 months ago
  • 3.0.1                                ...           8 months ago
  • 3.0.0                                ...           a year ago
  • 2.0.5                                ...           a year ago
  • 2.0.4                                ...           a year ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 1.0.0-alpha.7                                ...           2 years ago
  • 1.0.0-alpha.6                                ...           2 years ago
  • 1.0.0-alpha.3                                ...           2 years ago
  • 1.0.0-alpha.2                                ...           3 years ago
  • 1.0.0-alpha.1                                ...           3 years ago
Downloads
Today 0
This Week 1
This Month 5
Last Day 0
Last Week 2
Last Month 22
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |