diff --git a/app/pages/examples.njk b/app/pages/examples.njk index d384727bd..13bdadb06 100644 --- a/app/pages/examples.njk +++ b/app/pages/examples.njk @@ -132,6 +132,7 @@

Styles

{% endblock %} diff --git a/app/styles/typography.njk b/app/styles/typography.njk new file mode 100644 index 000000000..4ba5535a1 --- /dev/null +++ b/app/styles/typography.njk @@ -0,0 +1,83 @@ +{% set title = 'Typography' %} + +{% extends 'page.njk' %} + +{% block header %} + {{ super() }} +{% endblock %} + +{% block breadcrumb %} + {{ breadcrumb({ + items: [ + { + href: "../../", + text: "NHS.UK frontend" + }, + { + href: "../pages/examples.html", + text: "Examples" + } + ] + }) }} +{% endblock %} + +{% block content %} + +

Typography

+ + +

Visually-hidden text

+ +

Heading with visually hidden text at the beginning

+ +

Countries starting with A

+ +

Heading with visually hidden text at the end

+ +

Search all content

+ +

Heading that is visually hidden

+ +

Navigation menu

+ +
+ +

Paragraph that contains visually hidden text

+ +

This is a paragraph with some visually hidden text.

+ +
+ +

Table with visually hidden text

+ + + + + + + + + + + + + + + + + + + + + + +
2019
+ Date + + Day + + Name +
19 AprilFridayGood Friday
22 AprilMondayEaster Monday
+ + +{% endblock %} diff --git a/packages/core/tools/_mixins.scss b/packages/core/tools/_mixins.scss index 6febbbde5..bc903f864 100644 --- a/packages/core/tools/_mixins.scss +++ b/packages/core/tools/_mixins.scss @@ -38,6 +38,18 @@ // @mixin visually-hidden() { + // Absolute positioning has the unintended consequence of removing any + // whitespace surrounding visually hidden text from the accessibility tree. + // Insert a space character before and after visually hidden text to separate + // it from any visible text surrounding it. + &::before { + content: "\00a0"; + } + + &::after { + content: "\00a0"; + } + border: 0; clip: rect(0 0 0 0); -webkit-clip-path: inset(50%);