Skip to content

Instantly share code, notes, and snippets.

@alastc
alastc / aria-label-dection.css
Created October 25, 2019 08:56
Testing aria-labels with CSS
/* Useful for testing visible labels, highlights elements with aria-label(ledby) and puts in the content */
*[aria-label], *[aria-labelledby] {outline: 3px red solid !important;}
*[aria-label]::after, *[aria-labelledby]::after {
content: attr(aria-label);
color: red;
font-size: 1rem;
background: white;
position: absolute;
@alastc
alastc / text-spacing.css
Last active September 26, 2018 15:53
Text spacing CSS
/* for testing WCAG 2.1 SC 1.4.12, it is expected to be applied last or with JavaScript */
* {
line-height: 1.5 !important;
letter-spacing: 0.12em !important;
word-spacing: 0.16em !important;
}
p {
margin-bottom: 2em !important;
}
@alastc
alastc / power-focus.css
Last active January 14, 2019 07:58
CSS for use in tools like Stylus to create an obvious focus indicator.
/* CSS for use in tools like https://add0n.com/stylus.html to create an obvious focus indicator. */
*:-moz-focusring { /* change to :focus-visible for chrome */
outline: 2px transparent dashed !important;
box-shadow: 0 0 0 2px #F9F9D1, 0 0 0 4px #396196, 0 0 4px 8px #F9F9D1 !important;
transition: all 0.2s ease-in;
z-index: 1000;
overflow: visible;
}
@alastc
alastc / hiding-content.html
Last active December 29, 2015 17:49
How to hide content from view, and/or screen readers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<title>Methods to hide content in various ways</title>
<!--
This is an example page, published by @alastc at:
http://alastairc.ac/gists/7706437/hiding-content.html
@alastc
alastc / keyboard-focus-shiv.js
Last active December 29, 2015 16:29
Keyboard accessible within-page links script.
/*
Webkit browsers don't move the keyboard focus from internal links,
so this script adds the attributes to allow focus and then moves it.
Requires jQuery, and assumes you link to block level elements like <sections>
Published by @alastc On Github at:
https://gist.github.com/alastc/7698213
@alastc
alastc / PopOvers-Content.html
Last active December 27, 2015 14:29
A test page for accessible pop-overs, with JS &CSS in the head of the HTML file.
<!DOCTYPE html>
<html lang="en">
<head>
<!--
This is an example page, published by @alastc at:
http://alastairc.ac/gists/7340946/PopOvers-Content.html
On Github at: