|
| 1 | +/* Accessibility enhancements */ |
| 2 | + |
| 3 | +/* Focus management */ |
| 4 | +*:focus { |
| 5 | + outline: var(--focus-width) var(--focus-style) var(--focus-color); |
| 6 | + outline-offset: 2px; |
| 7 | +} |
| 8 | + |
| 9 | +*:focus:not(:focus-visible) { |
| 10 | + outline: none; |
| 11 | +} |
| 12 | + |
| 13 | +*:focus-visible { |
| 14 | + outline: var(--focus-width) var(--focus-style) var(--focus-color); |
| 15 | + outline-offset: 2px; |
| 16 | + box-shadow: var(--focus-box-shadow); |
| 17 | +} |
| 18 | + |
| 19 | +/* High contrast mode support */ |
| 20 | +@media (prefers-contrast: high) { |
| 21 | + * { |
| 22 | + border-color: CanvasText !important; |
| 23 | + } |
| 24 | + |
| 25 | + .btn { |
| 26 | + border: 2px solid CanvasText !important; |
| 27 | + } |
| 28 | + |
| 29 | + a { |
| 30 | + text-decoration: underline !important; |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +/* Reduced motion support */ |
| 35 | +@media (prefers-reduced-motion: reduce) { |
| 36 | + *, |
| 37 | + *::before, |
| 38 | + *::after { |
| 39 | + animation-duration: 0.01ms !important; |
| 40 | + animation-iteration-count: 1 !important; |
| 41 | + transition-duration: 0.01ms !important; |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +/* Screen reader only content */ |
| 46 | +.sr-only { |
| 47 | + position: absolute !important; |
| 48 | + width: 1px !important; |
| 49 | + height: 1px !important; |
| 50 | + padding: 0 !important; |
| 51 | + margin: -1px !important; |
| 52 | + overflow: hidden !important; |
| 53 | + clip: rect(0, 0, 0, 0) !important; |
| 54 | + white-space: nowrap !important; |
| 55 | + border: 0 !important; |
| 56 | +} |
| 57 | + |
| 58 | +/* Visually hidden but accessible to screen readers */ |
| 59 | +.visually-hidden { |
| 60 | + position: absolute !important; |
| 61 | + width: 1px !important; |
| 62 | + height: 1px !important; |
| 63 | + padding: 0 !important; |
| 64 | + margin: -1px !important; |
| 65 | + overflow: hidden !important; |
| 66 | + clip: rect(0, 0, 0, 0) !important; |
| 67 | + white-space: nowrap !important; |
| 68 | + border: 0 !important; |
| 69 | +} |
| 70 | + |
| 71 | +/* Skip link for keyboard navigation */ |
| 72 | +.skip-to-content { |
| 73 | + position: absolute; |
| 74 | + top: -40px; |
| 75 | + left: 6px; |
| 76 | + background: var(--color-primary); |
| 77 | + color: var(--color-white); |
| 78 | + padding: 8px; |
| 79 | + z-index: 10000; |
| 80 | + text-decoration: none; |
| 81 | +} |
| 82 | + |
| 83 | +.skip-to-content:focus { |
| 84 | + top: 6px; |
| 85 | +} |
| 86 | + |
| 87 | +/* Better contrast for links */ |
| 88 | +a { |
| 89 | + color: var(--text-link); |
| 90 | + text-decoration: underline; |
| 91 | + text-decoration-thickness: 1px; |
| 92 | + text-underline-offset: 2px; |
| 93 | +} |
| 94 | + |
| 95 | +a:hover, |
| 96 | +a:focus-visible { |
| 97 | + text-decoration-thickness: 2px; |
| 98 | + text-underline-offset: 3px; |
| 99 | +} |
| 100 | + |
| 101 | +/* Alerts for screen readers */ |
| 102 | +.alert--sr { |
| 103 | + position: absolute !important; |
| 104 | + width: 1px !important; |
| 105 | + height: 1px !important; |
| 106 | + padding: 0 !important; |
| 107 | + margin: -1px !important; |
| 108 | + overflow: hidden !important; |
| 109 | + clip: rect(0, 0, 0, 0) !important; |
| 110 | + white-space: nowrap !important; |
| 111 | + border: 0 !important; |
| 112 | +} |
| 113 | + |
| 114 | +/* ARIA live regions */ |
| 115 | +[aria-live="polite"], |
| 116 | +[aria-live="assertive"] { |
| 117 | + position: absolute !important; |
| 118 | + width: 1px !important; |
| 119 | + height: 1px !important; |
| 120 | + padding: 0 !important; |
| 121 | + margin: -1px !important; |
| 122 | + overflow: hidden !important; |
| 123 | + clip: rect(0, 0, 0, 0) !important; |
| 124 | + white-space: nowrap !important; |
| 125 | + border: 0 !important; |
| 126 | +} |
| 127 | + |
| 128 | +/* Semantic landmark roles */ |
| 129 | +[role="banner"] { |
| 130 | + display: block; |
| 131 | +} |
| 132 | + |
| 133 | +[role="navigation"] { |
| 134 | + display: block; |
| 135 | +} |
| 136 | + |
| 137 | +[role="main"] { |
| 138 | + display: block; |
| 139 | +} |
| 140 | + |
| 141 | +[role="contentinfo"] { |
| 142 | + display: block; |
| 143 | +} |
| 144 | + |
| 145 | +/* Table accessibility */ |
| 146 | +table { |
| 147 | + border-collapse: collapse; |
| 148 | + width: 100%; |
| 149 | +} |
| 150 | + |
| 151 | +th { |
| 152 | + font-weight: var(--font-weight-bold); |
| 153 | + text-align: left; |
| 154 | + vertical-align: top; |
| 155 | +} |
| 156 | + |
| 157 | +caption { |
| 158 | + font-weight: var(--font-weight-bold); |
| 159 | + margin-bottom: 0.5rem; |
| 160 | + text-align: left; |
| 161 | +} |
| 162 | + |
| 163 | +/* Input validation accessibility */ |
| 164 | +input[aria-invalid="true"], |
| 165 | +select[aria-invalid="true"], |
| 166 | +textarea[aria-invalid="true"] { |
| 167 | + border: 2px solid var(--color-danger); |
| 168 | + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); |
| 169 | +} |
| 170 | + |
| 171 | +input[aria-invalid="true"]:focus, |
| 172 | +select[aria-invalid="true"]:focus, |
| 173 | +textarea[aria-invalid="true"]:focus { |
| 174 | + box-shadow: var(--focus-box-shadow), inset 0 1px 2px rgba(0, 0, 0, 0.1); |
| 175 | +} |
| 176 | + |
| 177 | +/* Icon accessibility */ |
| 178 | +.icon { |
| 179 | + display: inline-block; |
| 180 | + width: 1em; |
| 181 | + height: 1em; |
| 182 | + vertical-align: -0.125em; |
| 183 | + fill: currentColor; |
| 184 | +} |
| 185 | + |
| 186 | +.icon:focus { |
| 187 | + outline: var(--focus-width) var(--focus-style) var(--focus-color); |
| 188 | +} |
| 189 | + |
| 190 | +/* Better button focus */ |
| 191 | +.btn:focus, |
| 192 | +button:focus, |
| 193 | +input[type="submit"]:focus, |
| 194 | +input[type="button"]:focus { |
| 195 | + box-shadow: var(--focus-box-shadow); |
| 196 | +} |
0 commit comments