// Accessibility // // A hidden screen reader for readers, focus elements for // vision impaired and other useful a11y CSS hacks. // Variables $focus-outline-color: #4d4aff; $focus-skip-link-color: #21759b; $focus-text-color: $color-black; $focus-outline-style: 2px solid; $focus-outline-style-large-elements: 4px solid; // 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; width: 1px; /* stylelint-disable declaration-no-important */ word-wrap: normal !important; // Many screen reader and browser combinations announce broken words as they would appear visually. /* stylelint-enable declaration-no-important */ &.skip-link { margin: 5px; &:focus { background: $color-white; color: $focus-outline-color; outline: 2px solid $focus-outline-color; } } &:focus { background-color: $color-lightgrey; border-radius: 0; box-shadow: 0 0 2px 2px rgba($color-black, .6); clip: auto; clip-path: none; color: $focus-skip-link-color; 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. } } // Suppress focus ring on for mouse and touch users for visual reasons /* stylelint-disable a11y/no-outline-none */ [data-whatinput="mouse"] *:focus, [data-whatinput="touch"] *:focus { outline: none; } /* stylelint-enable a11y/no-outline-none */ // Make sure outline is visible on cols that have .global-link .col { overflow: visible; } // Links within content must be underlined // @link https://make.wordpress.org/themes/handbook/review/accessibility/required/#content-links .gutenberg-content { 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; } } // Visually distinct focus color on keyboard [data-whatinput="keyboard"] { a:focus, input:focus, button:focus, select:focus, textarea:focus, nav li a:focus, div[tabindex]: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; // Let's make a "padding" for focus and more clear outline outline-offset: 5px; outline-width: 3px; // Browser defaults: /* stylelint-disable */ outline: 1px dotted $focus-outline-color; outline: 5px auto -webkit-focus-ring-color; color: $focus-text-color; /* stylelint-enable */ opacity: 1; z-index: 99; } // A bit better focus for large elements a.global-link:focus { outline-width: 5px; } } // Make theme keyboard accessible with no Javascript enabled .no-js *:focus { // outline: $focus-outline-style $focus-outline-color; // Browser defaults: /* stylelint-disable */ outline: 1px dotted $focus-outline-color; outline: 5px auto -webkit-focus-ring-color; color: $focus-text-color; /* stylelint-enable */ } // Add icon to external links a.is-external-link { align-items: center; display: inline-flex; justify-content: space-between; &::after { background-image: url('../svg/external-link.svg'); background-position: right center; background-repeat: no-repeat; background-size: 14px 14px; content: ''; display: inline-flex; height: 14px; margin-left: 5px; margin-right: 2px; position: relative; right: 0; top: 0; transition: all .18s ease-in-out; width: 14px; } } // Do not use external links indicators in tel and email links /* stylelint-disable a11y/no-display-none */ a.is-external-link.no-external-link-indicator::after { display: none; } /* stylelint-enable a11y/no-display-none */