Skip to content

Commit f9d4702

Browse files
authored
misc: disable search and address some accessibility violations (#1154)
1 parent 1e99683 commit f9d4702

File tree

5 files changed

+46
-11
lines changed

5 files changed

+46
-11
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "ef256fac-bada-4c42-8632-577faeac6800",
3+
"type": "misc",
4+
"description": "Disable search and address accessibility violations in documentation"
5+
}

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,10 @@
1818
outline-offset: 2px; /* Space between the outline and the button */
1919
}
2020

21-
#pages-search {
22-
margin: 0;
23-
padding-top: 10px;
24-
}
25-
2621
#pages-search:focus {
2722
outline: revert;
2823
}
2924

30-
#pages-search-label {
31-
display: none;
32-
}
33-
3425
/* copied from Dokka except for background-color attribute */
3526
.navigation {
3627
display: flex;
@@ -48,3 +39,19 @@
4839

4940
z-index: 4;
5041
}
42+
43+
/* Styles for section tabs like "Types" and "Functions" */
44+
.section-tab:focus, .section-tab:active {
45+
outline: 2px solid var(--active-tab-border-color); /* The color appears unresolved, but it is defined in Dokka style sheets */
46+
}
47+
48+
/*
49+
Dokka does not break links or code blocks properly by default. Add word-wrap to prevent left/right scrollbar from
50+
appearing on small screens.
51+
*/
52+
.main-content a:not([data-name]) {
53+
word-wrap: break-word;
54+
}
55+
.symbol {
56+
overflow-wrap: break-word;
57+
}

docs/dokka-presets/templates/includes/header.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
</div>
2424
<div class="navigation-controls">
2525
<button class="navigation-controls--btn navigation-controls--theme" id="theme-toggle-button" type="button">switch theme</button>
26-
<label for="pages-search" id="pages-search-label">Search</label>
27-
<div class="navigation-controls--btn navigation-controls--search" id="searchBar" role="button">search in API</div>
2826
</div>
2927
</nav>
3028
</#macro>

dokka-aws/src/main/kotlin/aws/sdk/kotlin/dokka/AwsDokkaPlugin.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package aws.sdk.kotlin.dokka
77

88
import aws.sdk.kotlin.dokka.transformers.FilterInternalApis
9+
import aws.sdk.kotlin.dokka.transformers.NoOpSearchbarDataInstaller
910
import org.jetbrains.dokka.base.DokkaBase
1011
import org.jetbrains.dokka.plugability.DokkaPlugin
1112
import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
@@ -25,6 +26,12 @@ class AwsDokkaPlugin : DokkaPlugin() {
2526
dokkaBase.preMergeDocumentableTransformer providing ::FilterInternalApis
2627
}
2728

29+
// FIXME Re-enable search once Dokka addresses performance issues
30+
// https://github.com/Kotlin/dokka/issues/2741
31+
val disableSearch by extending {
32+
dokkaBase.htmlPreprocessors providing ::NoOpSearchbarDataInstaller override dokkaBase.baseSearchbarDataInstaller
33+
}
34+
2835
@DokkaPluginApiPreview
2936
override fun pluginApiPreviewAcknowledgement() = PluginApiPreviewAcknowledgement
3037
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package aws.sdk.kotlin.dokka.transformers
7+
8+
import org.jetbrains.dokka.base.renderers.html.SearchRecord
9+
import org.jetbrains.dokka.base.renderers.html.SearchbarDataInstaller
10+
import org.jetbrains.dokka.pages.DriResolver
11+
import org.jetbrains.dokka.plugability.DokkaContext
12+
13+
/**
14+
* Disable the search bar data (pages.json).
15+
*/
16+
class NoOpSearchbarDataInstaller(context: DokkaContext) : SearchbarDataInstaller(context) {
17+
override fun generatePagesList(pages: List<SignatureWithId>, locationResolver: DriResolver): List<SearchRecord> = listOf()
18+
}

0 commit comments

Comments
 (0)