Skip to content

Commit 66ff76d

Browse files
committed
Ad skiplink to main on moblie; fix overlapping links
On mobile, the Roundup label at the top of the stacked table of contents becomes a link to jump to the top of the main body of the page. Without this there is no indication that a link on the main menu has been clicked and there is a lot of scrolling to get to the real content of the page. Ideally the left sidebar would become a menu link an be shown only when activated but .... Ran the top level pages through lighthouse to see how they do on mobile. Style changes added to fix links that overlap; fix links that were incorrectly displayed as blocks rather than in running text. Fixes some spacing issues with nested lists inside definition lists definition (dd) tags. Removed some indent when TOC follows n H1 header. Wrap search box on smaller screens so the search box doesn't overlap the jump link. Add back left margin to footer. Tried to prevent overlap with the prev/next/index submenu. It's better but still not good.
1 parent 7dc4f66 commit 66ff76d

File tree

2 files changed

+55
-6
lines changed

2 files changed

+55
-6
lines changed

website/www/_static/style.css

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ body
9090

9191
/* -14em is size of table of contents/nav */
9292
body > .header { margin: 0 0 0 -14em;}
93+
body > header > div.mobile { display:none; }
9394
body > .header div.label { font-size: 2em; font-weight: bold; margin: 0.67em 0 0.67em 1em;}
9495
body > .footer { margin: 1em 0 1em -14em; clear:both;}
9596
body > .navigation
@@ -311,6 +312,13 @@ div.admonition.caution p.admonition-title {
311312
dt { font-weight: bold; margin-block-start: 1em;}
312313
dt + dd { margin-block-start: 0.25em; }
313314
dd p.first { margin-block-start: 0; }
315+
dd > ul:first-child {
316+
/* reduce indent with list inside dd. I want to reduce
317+
margin-inline-start on dd but :has(> ul:first-child)
318+
doesn't work in firefox yet, so use negative margin
319+
on ul. */
320+
margin-inline-start: -32px;
321+
}
314322

315323
#skiplink { display: block;
316324
margin-block-start: 1em;
@@ -388,17 +396,55 @@ div.highlight > pre {
388396
body > .navigation li > ul > li { padding-block: 1em;
389397
/* move links away from each other */ }
390398
#roundup-issue-tracker .note { float: none; /* download box */}
391-
body > .footer { margin-inline-start: unset; }
399+
body > header > div.label.mobile { /* constrain nav label div */
400+
display: block;
401+
margin-inline-start: 0.5em;
402+
max-width: 48%;
403+
}
404+
405+
/* activate jump link and hide default label at top of stacked sidebar */
406+
body > header > div.mobile span.jumplabel {
407+
display: block;
408+
font-size: small;
409+
}
410+
body > header > div.non_mobile { display: none; }
411+
412+
body > .footer { margin-inline-start: 1em; }
392413

393414
/* changes for content */
394415
/* stop paths and things from overflowing the viewport. */
395416
div.content { overflow-wrap: break-word; }
396-
/* add spaces around items in TOC to make hitting the links easier */
417+
418+
/* add space between items in TOC to make hitting the links easier */
419+
li[class^=toctree] { margin-block: 1em; }
420+
li[class^=toctree] > ul { margin-top: 1em; }
421+
397422
div.contents ul.simple li { padding-block: .5em; }
398-
ul.simple li a { min-height: 48px;
399-
display: block;}
400-
}
401423

424+
h1 + div.contents > ul:first-child {
425+
/* reduce wasted whitespace to left in TOC */
426+
padding-inline-start: 1em;
427+
}
428+
#subnav {
429+
margin-block-end: 1em;
430+
min-height: 48px;
431+
}
432+
433+
/* use for table of links to increase space between
434+
links on small devices */
435+
table.linkspacing tr {height: 48px;}
436+
}
437+
438+
@media only screen and (max-width:512px) {
439+
/* prevent searchbox bleed into jumplink@top left. */
440+
#searchbox { max-width: 48%; }
441+
#searchbox > form {
442+
align-items: flex-end;
443+
display: inline-flex;
444+
flex-direction: column;
445+
}
446+
#searchbox > form > input[type=submit] { margin-block: 0.75em; }
447+
}
402448
/* Contact page */
403449
div#contact table td {
404450
white-space: nowrap;

website/www/_templates/layout.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@
7272
</head>
7373
<body>
7474
<div id="skiplink"><a href="#main">Skip to main content</a></div>
75-
<header class="header"><div class="label">Roundup</div>
75+
<header class="header">
76+
<div class="label non_mobile">Roundup</div>
77+
<div class="label mobile"><a href="#main">Roundup
78+
<span class="jumplabel">jump to {{ title|e }}</span></a></div>
7679
{%- if pagename != "search" %}
7780
<div id="searchbox" style="display: none">
7881
<form class="search" action="{{ pathto('search') }}" method="get">

0 commit comments

Comments
 (0)