// --------------------------------------------------------- // Accessibility // // A hidden screen reader for readers, focus elements for // vision impaired and other useful a11y CSS hacks. // --------------------------------------------------------- // Variables $focus-outline-color: #4d4aff; $focus-text-color: #000; $focus-outline-style: 2px solid; $focus-outline-style-large-elements: 4px solid; $tld-mobile: '192.168.196.2:3000'; $tld-browsersync: 'localhost:3000'; $tld-development: 'airdev.test'; $tld-staging: 'air.vaiheessa.fi'; $tld-production: 'dudetest.xyz'; // Text meant only for screen readers. .screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px; word-wrap: normal !important; // Many screen reader and browser combinations announce broken words as they would appear visually. &.skip-link { margin: 5px; &:focus { background: $color-white; color: $focus-outline-color; outline: 2px solid $focus-outline-color; } } &:focus { background-color: #f1f1f1; border-radius: 0; box-shadow: 0 0 2px 2px rgba(#000, .6); clip: auto !important; clip-path: none; color: #21759b; display: block; font-size: 1.7rem; font-weight: 700; height: auto; left: 5px; line-height: normal; padding: 15px 23px 14px; text-decoration: none; top: 5px; width: auto; z-index: 100000; // Above WP toolbar. } } // Do not show the outline on the skip link target. [tabindex="-1"]:focus { outline: 0; } // Suppress focus ring on for mouse and touch users for visual reasons [data-whatinput="mouse"] *:focus, [data-whatinput="touch"] *:focus { outline: none; } // Make sure outline is visible on cols that have .global-link body .block-image-links .cols .col, .col { overflow: visible; } // Visually distinct focus color on keyboard [data-whatinput="keyboard"] { input:focus, button:focus, select:focus, textarea:focus, div[tabindex]:focus, nav ul li a:focus, div[tabindex]:focus, a:focus { // Normalize the look of the outline across browsers // @link https://a11yproject.com/posts/never-remove-css-outlines/ outline: $focus-outline-style $focus-outline-color; color: $focus-text-color; opacity: 1; z-index: 99; } // A bit better focus for large elements a.global-link:focus { outline: $focus-outline-style-large-elements $focus-outline-color; } } // Make theme keyboard accessible with no Javascript enabled .no-js *:focus { outline: $focus-outline-style $focus-outline-color; } // Links within content must be underlined // @link https://make.wordpress.org/themes/handbook/review/accessibility/required/#content-links .container { a { text-decoration: underline; &:hover, &:focus { text-decoration: none; } } // With exceptions for those that are already styled: .comments-link a, .tags a, .cat a { text-decoration: none; } } // Add icon to external links a[href*="//"]:not([href*="#{$tld-production}"]):not([href*="#{$tld-staging}"]):not([href*="#{$tld-development}"]):not([href*="#{$tld-browsersync}"]):not([href*="#{$tld-mobile}"]):not(.no-external-link-indicator) { display: inline-flex; justify-content: space-between; align-items: center; &::after { background-image: url('../svg/external-link.svg'); background-position: right center; background-repeat: no-repeat; content: ''; position: relative; display: inline-flex; width: 14px; height: 14px; background-size: 14px 14px; right: 0; top: 0; margin-left: 5px; margin-right: 2px; transition: all .18s ease-in-out; } } // Do not use email links as external links a[href^="mailto"]::after { display: none; }