Diff options
| -rw-r--r-- | assets/cgit.css | 3 | |
| -rw-r--r-- | source/ui-stats.c | 5 | |
| -rwxr-xr-x | tests/t0112-stats.sh | 6 |
3 files changed, 12 insertions, 2 deletions
diff --git a/assets/cgit.css b/assets/cgit.css index cc3ad51..13845c4 100644 --- a/assets/cgit.css +++ b/assets/cgit.css @@ -185,7 +185,8 @@ div#cgit input[type="submit"]:hover { div#cgit a:focus-visible, div#cgit select:focus-visible, div#cgit input:focus-visible, -div#cgit table.bin-blob:focus-visible { +div#cgit table.bin-blob:focus-visible, +div#cgit table.stats:focus-visible { outline: solid 2px var(--link); outline-offset: 1px; } diff --git a/source/ui-stats.c b/source/ui-stats.c index ee5b76b..c22b027 100644 --- a/source/ui-stats.c +++ b/source/ui-stats.c @@ -311,7 +311,10 @@ static void print_authors(struct string_list *authors, int max_rows, const struc { size_t i, column, rows; - html("<table class='stats'>\n<tr><th scope='col'>Author</th>"); + // The table scrolls sideways on a narrow window, and since nothing in + // it can take focus, the table has to for a keyboard to scroll it. + html("<table class='stats' tabindex='0' aria-label='Commits per author'>\n" + "<tr><th scope='col'>Author</th>"); for (column = 0; column < labels->nr; column++) htmlf("<th scope='col'>%s</th>", labels->items[column].string); html("<th scope='col'>Total</th></tr>\n"); diff --git a/tests/t0112-stats.sh b/tests/t0112-stats.sh index 722a61c..4b45ee8 100755 --- a/tests/t0112-stats.sh +++ b/tests/t0112-stats.sh @@ -42,6 +42,12 @@ test_expect_success 'stats page renders the authors table' ' grep "<h2>Commits per author" tmp ' +# The table scrolls sideways on a narrow window with nothing in it a keyboard +# can reach, so the table itself takes focus. +test_expect_success 'the authors table can take keyboard focus' ' + grep "<table class=.stats. tabindex=.0. aria-label=.Commits per author.>" tmp +' + test_expect_success 'stat options sit above the content' ' tr -d "\n" <tmp | sed "s/<h2>Commits per author.*//" | grep "cgit-panel" ' |
