1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-20 04:12:09 +00:00

Improve tap target + font size for WCAG AAA

Increased font size to decrease chars-per-line (SC 1.4.8) and increase
tap target size.

Pad the nav links more and add some extra space between them to meet SC
2.5.5.
This commit is contained in:
Rohan Kumar 2022-05-03 17:05:47 -07:00
parent 992ba534af
commit 978b4b2b1a
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
5 changed files with 61 additions and 60 deletions

View file

@ -4,6 +4,6 @@
"font-family-no-duplicate-names": [ true, { "ignoreFontFamilyNames": ["monospace"] } ], "font-family-no-duplicate-names": [ true, { "ignoreFontFamilyNames": ["monospace"] } ],
"indentation": "tab", "indentation": "tab",
"max-nesting-depth": 1, "max-nesting-depth": 1,
"selector-max-compound-selectors": 2 "selector-max-compound-selectors": 3
} }
} }

View file

@ -36,7 +36,7 @@ clean:
.PHONY: lint-css .PHONY: lint-css
lint-css: lint-css:
pnpx stylelint --di --rd --rdd $(CSS_DIR)/main.css $(CSS_DIR)/dark.css pnpx stylelint --di --rd --rdd $(CSS_DIR)/main.css $(CSS_DIR)/dark.css $(CSS_DIR)/print.css
csslint --quiet $(CSS_DIR) csslint --quiet $(CSS_DIR)
.PHONY: hint .PHONY: hint

View file

@ -4,11 +4,14 @@
* usability need. * usability need.
* I also don't use any classes besides "unstyled-list" and "pix". My * I also don't use any classes besides "unstyled-list" and "pix". My
* HTML contains microformats2 classnames for IndieWeb parsers, but I * HTML contains microformats2 classnames for IndieWeb parsers, but I
* don't actually use those for styling. */ * don't actually use those for styling.
*
* I cite WCAG 2.2 success criterions with "SC". */
html { html {
/* Mobile screens benefit from greater line-spacing so links are /* Mobile screens benefit from greater line-spacing so links are
* further apart. Dyslexic users prefer the spacing too. * further apart. Dyslexic users prefer the spacing too.
* Necessary to meet SC 1.4.8.
* <100dpi screens: sans-serif is better. Why did browsers settle * <100dpi screens: sans-serif is better. Why did browsers settle
* on serif being the default?? */ * on serif being the default?? */
font: 100%/1.5 sans-serif; font: 100%/1.5 sans-serif;
@ -21,54 +24,60 @@ html {
* wide variety of complex pages. For single-column websites like * wide variety of complex pages. For single-column websites like
* mine, it's ideal to bump it up ever so slightly. This also makes * mine, it's ideal to bump it up ever so slightly. This also makes
* <sup>, <sub>, <small>, etc. large enough to have decent contrast * <sup>, <sub>, <small>, etc. large enough to have decent contrast
* with minimal adjustment. * with minimal adjustment, and makes tap-targets larger.
* Only do this on screen, since printouts already improve legibility * Only do this on screen, since printouts already improve legibility
* and cost paper + ink. */ * and cost paper + ink. */
font-size: 105%; font-size: 110%;
/* Aligning to the center with space on both sides prevents accidental /* Aligning to the center with space on both sides prevents accidental
* link activation on tablets. */ * link activation on tablets, and is a common practice that users are
* more used to. */
margin: auto; margin: auto;
/* WCAG recommends a max line width. Not everyone can resize the /* WCAG recommends a max line width. Not everyone can resize the
* viewport. * viewport. This isn't for large blocks of text yet, so we don't have
* to go by SC 1.4.8.
* 45em = lowest acceptable width for titles, nav, footers, etc */ * 45em = lowest acceptable width for titles, nav, footers, etc */
max-width: 45em; max-width: 45em;
padding: 0 3%; padding: 0 3%;
} }
/* 45em is too wide for long body text. */ /* 45em is too wide for long body text.
* Typically meets SC 1.4.8, plus or minus a few characters. */
div[itemprop="articleBody"] { div[itemprop="articleBody"] {
margin: auto; margin: auto;
max-width: 38em; max-width: 36em;
} }
/* Compensate for misalignment caused by a padding increase. */ /* Compensate for misalignment and wasted space caused by a padding
header nav, * increase. */
footer nav { nav:not([role="doc-toc"]) {
margin: -.375em; margin: -.5em 0 -.5em -.25em;
} }
/* Increase nav link tap target size a bit */ /* SC 2.5.5: Increase nav link tap target size a bit */
nav a { nav:not([role="doc-toc"]) a {
padding: .125em; padding: .75em .25em;
} }
nav li { nav li {
line-height: 2; margin-bottom: .75em;
margin-top: .75em;
} }
} }
/* Small text is easier to read when slightly bolder. /* Save some space and paper by making the site nav and footer
* This is important in the dark theme where I set my own colors and * links single-line, but bump up the line-height to increase
* try to maintain good perceptual contrast even for small text, but * space between tap-targets (a11y) */
* I don't want toggling the theme to impact anything besides color so header li,
* I set the weight here. */ footer li {
sup { display: inline-block;
font-weight: 600; margin-right: .75em;
line-height: 1.75
} }
/* narrow screens: reduce margin for blockquotes a lot, using /* narrow screens: reduce margin for blockquotes a lot, using
* a thick left-side border instead. */ * a thick left-side border instead. */
blockquote { blockquote {
@ -103,24 +112,14 @@ h1 {
} }
/* Very narrow screens: full hyphenation */ /* Very narrow screens: full hyphenation */
@media (max-width: 11.6em) { @media (max-width: 12em) {
article, article,
h2, h2,
h3 { h3 {
hyphens: auto hyphens: auto;
} }
} }
/* Save some space and paper by making the site nav and footer
* links single-line, but bump up the line-height to increase
* space between tap-targets (a11y) */
header li,
footer li {
display: inline-block;
margin: .25em;
}
/* Lists without bullets: navlinks, posts lists, webmentions. /* Lists without bullets: navlinks, posts lists, webmentions.
* Those three are lists whose items are already easily * Those three are lists whose items are already easily
* distinguishable, rendering bullet points as unnecessary extra * distinguishable, rendering bullet points as unnecessary extra
@ -136,8 +135,14 @@ footer li {
/* <kbd> should be distinguished from <code> and surrounding text /* <kbd> should be distinguished from <code> and surrounding text
* in a way beyond font-face; at least two visual distinctions needed */ * in a way beyond font-face; at least two visual distinctions needed
kbd { * Also, Small text is easier to read when slightly bolder.
* This is important in the dark theme where I set my own colors and
* try to maintain good perceptual contrast even for small text, but
* I don't want toggling the theme to impact anything besides color so
* I set the weight here. */
kbd,
sup {
font-weight: bold; font-weight: bold;
} }
@ -171,15 +176,12 @@ li[itemprop="comment"],
:not(pre) > samp, :not(pre) > samp,
span[itemtype="https://schema.org/Person"] { span[itemtype="https://schema.org/Person"] {
overflow-wrap: break-word; overflow-wrap: break-word;
/* borders shouldn't touch text */
padding: 0 0.1em;
} }
/* Narrow screens: allow horizontal scroll in a pre block. */ /* Narrow screens: allow horizontal scroll in a pre block. */
pre { pre {
overflow: auto;
padding: .5em; padding: .5em;
overflow: auto;
} }
/* Distinguish images from the background in case their color is /* Distinguish images from the background in case their color is
@ -198,9 +200,13 @@ pre,
:not(pre) > code, :not(pre) > code,
:not(pre) > samp { :not(pre) > samp {
border-color: #999; border-color: #999;
/* borders shouldn't touch text */
padding: 0 0.1em;
} }
/* Some images look blurry when scaled */ /* Some images look blurry when scaled; this makes them easier to
* read. */
.pix { .pix {
image-rendering: pixelated; image-rendering: pixelated;
} }
@ -212,7 +218,7 @@ img:not(.u-photo) {
display: block; display: block;
height: auto; height: auto;
margin: auto; margin: auto;
max-width: 100%; max-width: 95%;
} }
/* WCAG Technique C25: use borders to separate sections. /* WCAG Technique C25: use borders to separate sections.
@ -221,7 +227,7 @@ img:not(.u-photo) {
footer, footer,
section[aria-labelledby="webmentions"], section[aria-labelledby="webmentions"],
div[role="doc-endnotes"] { div[role="doc-endnotes"] {
border-top: 1px solid; border-top: 2px solid;
content-visibility: auto; content-visibility: auto;
} }

View file

@ -6,23 +6,18 @@
span[aria-hidden], span[aria-hidden],
/* You can't navigate in a printout. */ /* You can't navigate in a printout. */
footer nav, footer nav,
header nav a:not([rel="home"]) span { nav a:not([rel="home"]) span {
display: none; display: none;
} }
/* unerlines in TOC get in the way. */
nav[role="doc-toc"] a {
text-decoration: none;
}
} }
/* Print: don't orphan headings */ /* Print: don't orphan headings
h2, * Commented out bc most browsers don't obey this yet. */
h3, /* h2, */
h4 { /* h3, */
break-after: avoid; /* h4 { */
} /* break-after: avoid; */
/* } */
figure, figure,
article article, article article,

View file

@ -11,7 +11,7 @@
<a itemprop="codeRepository" rel="source" href="{{ .Site.Params.src }}">Source code</a> <a itemprop="codeRepository" rel="source" href="{{ .Site.Params.src }}">Source code</a>
</li> </li>
<li> <li>
<a rel="alternate" href="http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion{{ .RelPermalink }}">Tor</a> <a rel="alternate" href="http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion{{ .RelPermalink }}">Tor mirror</a>
</li> </li>
<li> <li>
<a href="{{ site.BaseURL }}privacy.html">Privacy</a> <a href="{{ site.BaseURL }}privacy.html">Privacy</a>