_screen-reader.scss 811 B

12345678910111213141516171819202122232425262728293031323334
  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. margin: -1px; // Fix for https://github.com/twbs/bootstrap/issues/25686
  11. overflow: hidden;
  12. clip: rect(0, 0, 0, 0);
  13. white-space: nowrap;
  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. }
  31. }