Skip to content

Commit f1ded0f

Browse files
committed
feat: Re-instate "Skip link" to the mobile-theme (#5)
1 parent bd4061d commit f1ded0f

4 files changed

Lines changed: 48 additions & 3 deletions

File tree

plugins/mobile-theme/_includes/layouts/page.njk

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ layout: dia_outer_page
66
<meta charset="utf-8">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<meta name="generator" content="{{ eleventy.generator }}">
9-
<base href="{% myBaseUrl %}">
9+
<!-- <base href="{% myBaseUrl %}"> -->
1010

1111
<link rel="manifest" href="./manifest.json">
12-
<link rel="stylesheet" href="./css/index.css">
12+
<link rel="stylesheet" href="/css/index.css">
1313

1414
{% include '../en/dc-metadata.njk' %}
1515
{# {% include '../head/stylesheets.njk' %} #}
@@ -21,13 +21,16 @@ layout: dia_outer_page
2121

2222
</head>
2323
<body>
24+
<skip-link>
25+
<a href="#main-content">Skip to main content</a>
26+
</skip-link>
2427
{% include '../en/header.njk' %}
2528

2629
<share-button></share-button>
2730

2831
<page-note hidden></page-note>
2932

30-
<main id="main">
33+
<main id="main-content">
3134
{{ content | safe }}
3235
</main>
3336

plugins/mobile-theme/css/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
@import "https://esm.sh/gh/nfreear/fix-title-attr/style.css";
88
/* @import "https://esm.sh/fix-title-attr@0.9.5/style.css" */
99
@import "custom-elements.css" screen;
10+
@import "skip-link.css";
1011

1112
/* Print and aural */
1213
@import "print.css" print;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
:root {
2+
--dia-transition: 250ms;
3+
}
4+
5+
@media (prefers-reduced-motion: reduce) {
6+
:root {
7+
--dia-transition: 0;
8+
}
9+
}
10+
11+
skip-link {
12+
position: relative;
13+
14+
a {
15+
background-color: var(--dia-bg-color, white);
16+
display: inline-block;
17+
position: absolute;
18+
height: 0;
19+
width: 0;
20+
overflow: hidden;
21+
22+
&:focus {
23+
border: 2px solid var(--dia-theme-color, gray);
24+
height: auto;
25+
min-width: 11rem;
26+
padding: .6rem;
27+
transition: all var(--dia-transition);
28+
}
29+
}
30+
}
31+
32+
main {
33+
a.skip {
34+
display: none;
35+
}
36+
}

plugins/shortcode/baseUrlShortcodePlugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* @see https://codepen.io/nfreear/pen/RNRWmpP
66
*/
77
export default function baseUrlShortcodePlugin (eleventyConfig, options) {
8+
/**
9+
* Used on the 404 error page, "404.html"!
10+
*/
811
eleventyConfig.addShortcode('myBaseUrl', function () {
912
// Only use the configurable `buildBaseUrl` option in "build" mode (not "serve" mode)!
1013
const isBuild = (this.eleventy.env.runMode === 'build');
@@ -13,6 +16,8 @@ export default function baseUrlShortcodePlugin (eleventyConfig, options) {
1316
return baseUrl;
1417
});
1518

19+
/** Used in "sitemap-xml.html"
20+
*/
1621
eleventyConfig.addFilter('myAbsoluteUrl', function (path) {
1722
console.assert(process.env.ABSOLUTE_URL, 'Missing ABSOLUTE_URL environment variable.');
1823
return `${process.env.ABSOLUTE_URL}${path}`;

0 commit comments

Comments
 (0)