|
2 | 2 | // @name GitHub Accessibility Fixes |
3 | 3 | // @namespace http://axSgrease.nvaccess.org/ |
4 | 4 | // @description Improves the accessibility of GitHub. |
5 | | -// @author James Teh <jteh@mozilla.com> |
6 | | -// @copyright 2019-2025 Mozilla Corporation, Derek Riemer |
| 5 | +// @author James Teh <jteh@mozilla.com>, Sascha Cowley <sascha@nvaccess.org> |
| 6 | +// @copyright 2019-2025 Mozilla Corporation, Derek Riemer, Sascha Cowley |
7 | 7 | // @license Mozilla Public License version 2.0 |
8 | | -// @version 2025.1 |
| 8 | +// @version 2025.2 |
9 | 9 | // @include https://github.com/* |
10 | 10 | // ==/UserScript== |
11 | 11 |
|
@@ -168,6 +168,27 @@ const DYNAMIC_TWEAKS = [ |
168 | 168 | // Remove headings from folder and file lists. |
169 | 169 | {selector: 'table[aria-labelledby=folders-and-files] :is(h2, h3)', |
170 | 170 | tweak: makePresentational}, |
| 171 | + // Make file viewer filenames headings, and the first item in the file viewer. |
| 172 | + {selector: '.file-header .file-info .Truncate:has(.Link--primary)', |
| 173 | + tweak: el => { |
| 174 | + makeHeading(el, 2); |
| 175 | + const headerRow = el.parentElement; |
| 176 | + const children = Array.from(headerRow.children); |
| 177 | + // Filename is the last child of .file-info, make it the first |
| 178 | + children.unshift(children.pop()); |
| 179 | + if (headerRow) { |
| 180 | + makeElementOwn(headerRow, children); |
| 181 | + } |
| 182 | + }}, |
| 183 | + // Label diffs and the like with their filename. |
| 184 | + {selector: '.file', |
| 185 | + tweak: el => { |
| 186 | + const label = el.querySelector(".Link--primary"); |
| 187 | + const file = el.querySelector(".js-file-content"); |
| 188 | + if (label && file) { |
| 189 | + makeRegion(file, label.textContent); |
| 190 | + } |
| 191 | + }}, |
171 | 192 | ]; |
172 | 193 |
|
173 | 194 | /*** Lights, camera, action! ***/ |
|
0 commit comments