New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/theme-a11y

Package Overview
Dependencies
Maintainers
20
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/theme-a11y

A library of useful functions that help make your theme more accessible.

  • 4.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
666
decreased by-32.73%
Maintainers
20
Weekly downloads
 
Created
Source

@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:

  • theme-a11y.js
  • theme-a11y.min.js

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

Keywords

FAQs

Package last updated on 15 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc