0.0.12 • Published 21 days ago

@substrate-system/a11y v0.0.12

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
21 days ago

a11y

tests semantic versioning Common Changelog dependencies install size license

Factoring out some common CSS utilities, so there is less duplication across projects.

featuring

install

npm i -S @substrate-system/a11y

Use

This package exposes CSS only.

example

Put the relevant classes in your HTML.

<button>
  <svg><!--  icon here  --></svg>
  <span class="visually-hidden">My Cool Button text</span>
</button>

Bundler

If using a bundler, import the package as normal.

import '@substrate-system/a11y'

Or import specific things

import '@substrate-system/a11y/visually-hidden'

Or minified:

import '@substrate-system/a11y/min'

CSS imports

Import in CSS:

@import url("../node_modules/@substrate-system/a11y/dist/index.min.css");

Link

If you don't want to use a bundler, this package exposes minified CSS files too. You can copy them to a location that is accessible to your web server, then link to them directly in HTML.

copy

cp ./node_modules/@substrate-system/a11y/dist/index.min.css ./public/a11y.css

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="./a11y.css">
</head>
</html>

API

This package exposes CSS that will look for the following classes.

visually-hidden

Use this to create accessible buttons with no visible text.

See this article.

Bundler

import '@substrate-system/a11y/visually-hidden'

CSS Import

@import url("../node_modules/@substrate-system/a11y/dist/visually-hidden.min.css");

example

<button>
    <svg><!--  icon here  --></svg>
    <span class="visually-hidden">Button text</span>
</button>

prefers-reduced-motion

Disable smooth scrolling if the prefers-reduced-motion media query is set.

Bundler

import '@substrate-system/a11y/reduced-motion'

CSS Import

@import url("../node_modules/@substrate-system/a11y/dist/reduced-motion.min.css");

see also

0.0.10

1 month ago

0.0.11

1 month ago

0.0.12

21 days ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.7

3 months ago

0.0.3

7 months ago

0.0.5

4 months ago

0.0.2

9 months ago

0.0.1

9 months ago

0.0.0

9 months ago