Skip to content

Commit 0ec5fd1

Browse files
pekkahclaude
andauthored
fix: resolve multiple UI and configuration issues (#280)
* fix: resolve multiple UI and configuration issues - Fix init command templates to generate correct configuration format (#279) - Change 'name:' to 'title:' to match SiteDefinition schema - Remove non-existent 'description:' field - Replace 'sources:' with proper 'branches:' and 'tags:' structure - Add required fields: base_path, index_page, proper input_path arrays - Add missing type='button' attribute to navigation toggle (#267) - Improves accessibility and follows HTML best practices - Fixes NavigationItem.hbs template - Remove duplicated theme handling functions in article.hbs (#266) - Consolidate theme initialization into single comprehensive script - Eliminates code duplication while maintaining functionality These fixes improve new user onboarding, accessibility, and code quality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: address FOUC issue in theme handling Based on Gemini Code Assist review feedback, re-introduce minimal theme script in head to prevent 'flash of unstyled content' while maintaining the goal of reducing code duplication. - Add minimal blocking script in <head> for immediate theme application - Remove redundant setTheme call from DOMContentLoaded handler - Preserves user experience while keeping comprehensive theme management Addresses: #280 (comment) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent bca3564 commit 0ec5fd1

File tree

4 files changed

+54
-62
lines changed

4 files changed

+54
-62
lines changed

src/DocsTool/Resources/default-tanka-docs-wip.yml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,11 @@
22
# Generated by: tanka-docs init
33
# This configuration uses HEAD (current working directory state) for faster development iteration
44

5-
name: "{{PROJECT_NAME}} (WIP)"
6-
description: "Development version of {{PROJECT_NAME}} documentation"
7-
8-
# Content sources - Use working directory for WIP builds
9-
sources:
10-
- source: git-branch
11-
branch: HEAD # Uses current working directory state
12-
path: docs/
13-
14-
# Output configuration
15-
output_path: _build-wip/
16-
build_path: _site-wip/
17-
18-
# UI configuration
19-
ui_bundle: ui-bundle/
20-
21-
# Processing options
22-
extensions:
23-
- include
24-
- xref
5+
base_path: "/"
6+
title: "{{PROJECT_NAME}} (WIP)"
7+
index_page: xref://root@HEAD:index.md
8+
output_path: "_build-wip"
9+
build_path: "_site-wip"
2510

2611
# Homepage link configuration (optional)
2712
homepage:
@@ -30,5 +15,16 @@ homepage:
3015
target: "_blank"
3116
enabled: false
3217

33-
# Development settings
34-
base_path: ""
18+
# Content sources - Use current working directory (HEAD) for WIP builds
19+
branches:
20+
HEAD:
21+
input_path:
22+
- docs
23+
- ui-bundle
24+
25+
# Development typically doesn't need tags, but you can add them if needed:
26+
#tags:
27+
# v1.*:
28+
# input_path:
29+
# - docs
30+
# - ui-bundle
Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
# Tanka Docs Configuration (Production)
22
# Generated by: tanka-docs init
33

4-
name: "{{PROJECT_NAME}}"
5-
description: "Documentation for {{PROJECT_NAME}}"
6-
7-
# Content sources - Git branches/tags for stable builds
8-
sources:
9-
- source: git-branch
10-
branch: "{{DEFAULT_BRANCH}}"
11-
path: docs/
12-
13-
# Output configuration
14-
output_path: _build/
15-
build_path: _site/
16-
17-
# UI configuration
18-
ui_bundle: ui-bundle/
19-
20-
# Processing options
21-
extensions:
22-
- include
23-
- xref
4+
base_path: "/"
5+
title: "{{PROJECT_NAME}}"
6+
index_page: xref://root@{{DEFAULT_BRANCH}}:index.md
7+
output_path: "gh-pages"
8+
build_path: "_build"
249

2510
# Homepage link configuration (optional)
2611
homepage:
2712
url: ""
2813
text: "Home"
2914
target: "_blank"
3015
enabled: false
31-
32-
# Development settings (override in tanka-docs-wip.yml for WIP builds)
33-
base_path: ""
16+
17+
# Content sources - Git branches/tags for stable builds
18+
branches:
19+
{{DEFAULT_BRANCH}}:
20+
input_path:
21+
- docs
22+
- ui-bundle
23+
24+
# Add tags configuration for versioned documentation
25+
# Uncomment and customize as needed:
26+
#tags:
27+
# v1.*:
28+
# input_path:
29+
# - docs
30+
# - ui-bundle
31+
# v2.*:
32+
# input_path:
33+
# - docs
34+
# - ui-bundle

ui-bundle/article.hbs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,25 @@
1212

1313
<!-- Color mode toggler -->
1414
<script>
15+
// This minimal script runs early to prevent a "flash of unstyled content" (FOUC) by setting the theme before the page renders.
1516
(() => {
16-
'use strict'
17-
18-
const getStoredTheme = () => localStorage.getItem('theme')
19-
const setStoredTheme = theme => localStorage.setItem('theme', theme)
20-
17+
'use strict';
18+
const getStoredTheme = () => localStorage.getItem('theme');
2119
const getPreferredTheme = () => {
22-
const storedTheme = getStoredTheme()
20+
const storedTheme = getStoredTheme();
2321
if (storedTheme) {
24-
return storedTheme
22+
return storedTheme;
2523
}
26-
27-
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
28-
}
29-
24+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
25+
};
3026
const setTheme = theme => {
3127
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
32-
document.documentElement.setAttribute('data-bs-theme', 'dark')
28+
document.documentElement.setAttribute('data-bs-theme', 'dark');
3329
} else {
34-
document.documentElement.setAttribute('data-bs-theme', theme)
30+
document.documentElement.setAttribute('data-bs-theme', theme);
3531
}
36-
}
37-
38-
setTheme(getPreferredTheme())
32+
};
33+
setTheme(getPreferredTheme());
3934
})()
4035
</script>
4136

ui-bundle/partials/NavigationItem.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{#if Children}}
33
<div class="d-flex justify-content-between align-items-center">
44
{{#link_to DisplayLink}}<a class="nav-link" href={{url}}>{{title}}</a>{{/link_to}}
5-
<button class="btn btn-sm btn-link p-0" data-bs-toggle="collapse" data-bs-target="#nav-{{DisplayLink.Link.Xref.Path}}" aria-expanded="false" aria-controls="nav-{{DisplayLink.Link.Xref.Path}}" aria-label="Toggle submenu">
5+
<button type="button" class="btn btn-sm btn-link p-0" data-bs-toggle="collapse" data-bs-target="#nav-{{DisplayLink.Link.Xref.Path}}" aria-expanded="false" aria-controls="nav-{{DisplayLink.Link.Xref.Path}}" aria-label="Toggle submenu">
66
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="currentColor" class="bi bi-chevron-down" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>
77
</button>
88
</div>

0 commit comments

Comments
 (0)