_screen-reader.scss 733 B

123456789101112131415161718192021222324252627282930313233
  1. // Only display content to screen readers
  2. //
  3. // See: https://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. border: 0;
  14. }
  15. // Use in conjunction with .sr-only to only display content when it's focused.
  16. //
  17. // Useful for "Skip to main content" links; see https://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
  18. //
  19. // Credit: HTML5 Boilerplate
  20. @mixin sr-only-focusable {
  21. &:active,
  22. &:focus {
  23. position: static;
  24. width: auto;
  25. height: auto;
  26. overflow: visible;
  27. clip: auto;
  28. white-space: normal;
  29. }
  30. }