Skip to content

Commit 057e0f0

Browse files
authored
fix: address minor accessibility issues with generated API ref docs (#809)
1 parent ebb52d4 commit 057e0f0

File tree

7 files changed

+111
-1
lines changed

7 files changed

+111
-1
lines changed

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ allprojects {
4646
"${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png")}"
4747
],
4848
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.",
49-
"separateInheritedMembers" : true
49+
"separateInheritedMembers" : true,
50+
"templatesDir": "${rootProject.file("docs/dokka-presets/templates")}"
5051
}
5152
"""
5253
)

docs/dokka-presets/css/aws-styles.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,22 @@
77
:root {
88
--color-dark: #232f3e;
99
}
10+
11+
#leftToggler {
12+
background: none;
13+
border: none;
14+
padding: 0;
15+
}
16+
17+
#pages-search {
18+
margin: 0;
19+
padding-top: 10px;
20+
}
21+
22+
#pages-search:focus {
23+
outline: revert;
24+
}
25+
26+
#pages-search-label {
27+
display: none;
28+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<#import "includes/page_metadata.ftl" as page_metadata>
2+
<#import "includes/header.ftl" as header>
3+
<#import "includes/footer.ftl" as footer>
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
<head>
7+
<meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
8+
<@page_metadata.display/>
9+
<@template_cmd name="pathToRoot">
10+
<script>var pathToRoot = "${pathToRoot}";</script>
11+
</@template_cmd>
12+
<#-- This script doesn't need to be there but it is nice to have
13+
since app in dark mode doesn't 'blink' (class is added before it is rendered) -->
14+
<script>const storage = localStorage.getItem("dokka-dark-mode")
15+
if (storage == null) {
16+
const osDarkSchemePreferred = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
17+
if (osDarkSchemePreferred === true) {
18+
document.getElementsByTagName("html")[0].classList.add("theme-dark")
19+
}
20+
} else {
21+
const savedDarkMode = JSON.parse(storage)
22+
if(savedDarkMode === true) {
23+
document.getElementsByTagName("html")[0].classList.add("theme-dark")
24+
}
25+
}
26+
</script>
27+
<#-- Resources (scripts, stylesheets) are handled by Dokka.
28+
Use customStyleSheets and customAssets to change them. -->
29+
<@resources/>
30+
</head>
31+
<body>
32+
<@header.display/>
33+
<div id="container">
34+
<div id="leftColumn">
35+
<div id="sideMenu"></div>
36+
</div>
37+
<div id="main">
38+
<@content/>
39+
<@footer.display/>
40+
</div>
41+
</div>
42+
</body>
43+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<#macro display>
2+
<div class="footer">
3+
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>${footerMessage}</span><span
4+
class="pull-right"><span>Generated by </span><a
5+
href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
6+
</div>
7+
</#macro>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<#import "source_set_selector.ftl" as source_set_selector>
2+
<#macro display>
3+
<div class="navigation-wrapper" id="navigation-wrapper">
4+
<button id="leftToggler" aria-label="Open navigation menu"><span class="icon-toggler"></span></button>
5+
<div class="library-name">
6+
<@template_cmd name="pathToRoot">
7+
<a href="${pathToRoot}index.html">
8+
<@template_cmd name="projectName">
9+
<span>${projectName}</span>
10+
</@template_cmd>
11+
</a>
12+
</@template_cmd>
13+
</div>
14+
<div>
15+
<#-- This can be handled by the versioning plugin -->
16+
<@version/>
17+
</div>
18+
<div class="pull-right d-flex">
19+
<@source_set_selector.display/>
20+
<button id="theme-toggle-button"><span id="theme-toggle"></span></button>
21+
<label for="pages-search" id="pages-search-label">Search</label>
22+
<div id="searchBar"></div>
23+
</div>
24+
</div>
25+
</#macro>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<#macro display>
2+
<title>${pageName}</title>
3+
<@template_cmd name="pathToRoot">
4+
<link href="${pathToRoot}images/logo-icon.svg" rel="icon" type="image/svg">
5+
</@template_cmd>
6+
</#macro>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<#macro display>
2+
<#if sourceSets?has_content>
3+
<div class="filter-section" id="filter-section">
4+
<#list sourceSets as ss>
5+
<button class="platform-tag platform-selector ${ss.platform}-like" data-active="" data-filter="${ss.filter}">${ss.name}</button>
6+
</#list>
7+
</div>
8+
</#if>
9+
</#macro>

0 commit comments

Comments
 (0)