_screen-reader.scss 778 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Only display content to screen readers
  2. //
  3. // See: http://a11yproject.com/posts/how-to-hide-content/
  4. // See: https://hugogiraudel.com/2016/10/13/css-hide-and-seek/
  5. @mixin sr-only {
  6. position: absolute;
  7. width: 1px;
  8. height: 1px;
  9. padding: 0;
  10. overflow: hidden;
  11. clip: rect(0, 0, 0, 0);
  12. white-space: nowrap;
  13. clip-path: inset(50%);
  14. border: 0;
  15. }
  16. // Use in conjunction with .sr-only to only display content when it's focused.
  17. //
  18. // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
  19. //
  20. // Credit: HTML5 Boilerplate
  21. @mixin sr-only-focusable {
  22. &:active,
  23. &:focus {
  24. position: static;
  25. width: auto;
  26. height: auto;
  27. overflow: visible;
  28. clip: auto;
  29. white-space: normal;
  30. clip-path: none;
  31. }
  32. }