summaryrefslogtreecommitdiffstats
path: root/assets/sass/@primer/css/utilities/visibility-display.scss
blob: 61c6f5f83660fe9da9cf8eef89d96018dd788cc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Visibility and display utilities

// Responsive display utilities
@each $breakpoint, $variant in $responsive-variants {
  @include breakpoint($breakpoint) {
    @each $display in $display-values {
      .d#{$variant}-#{$display} { display: $display !important; }
    }
  }
}

.v-hidden { visibility: hidden !important; }
.v-visible { visibility: visible !important; }

// Hide utilities for each breakpoint
// Each hide utility only applies to one breakpoint range.
@media (max-width: $width-sm - 1px) {
  .hide-sm {
    display: none !important;
  }
}

@media (min-width: $width-sm) and (max-width: $width-md - 1px) {
  .hide-md {
    display: none !important;
  }
}

@media (min-width: $width-md) and (max-width: $width-lg - 1px) {
  .hide-lg {
    display: none !important;
  }
}

@media (min-width: $width-lg) {
  .hide-xl {
    display: none !important;
  }
}

/* Set the table-layout to fixed */
.table-fixed { table-layout: fixed !important; }

// Only display content to screen readers
//
// See: http://a11yproject.com/posts/how-to-hide-content/
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1241631
  word-wrap: normal;
  border: 0;
}

// Only display content on focus
.show-on-focus {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);

  &:focus {
    z-index: 20;
    width: auto;
    height: auto;
    clip: auto;
  }
}