Skip to content

refactor(content): share native disclosures with code blocks - #94

Merged
hakula139 merged 2 commits into
mainfrom
fix/native-code-disclosures
Oct 3, 2026
Merged

hakula139 merged 2 commits into
mainfrom
fix/native-code-disclosures

Conversation

@hakula139

@hakula139 hakula139 commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Use native code-block disclosures from kiln and share summary markers, open-state chevrons, body transitions, and reduced-motion behavior with callouts and the mobile TOC. Remove the custom JavaScript toggler, keeping clipboard behavior. Require kiln 0.4.0-rc.3 so older renderers fail the existing version check before producing incompatible code-block markup. Cancel the copy click default before replacing its icon so native summary activation cannot toggle the block after the original click target is detached. Direct-child chevron selectors keep nested disclosure states independent.

Verification

  • pnpm build, pnpm format, pnpm lint, pnpm spellcheck, nix flake check, and git diff --check passed. Compiled CSS matches the source.
  • Headless Chromium, Firefox, and WebKit fixtures using the compiled CSS and shipped JavaScript passed native Enter / Space toggling with JavaScript enabled and disabled, initial collapsed state, nested disclosure chevrons, line-limit scrolling, reduced motion, and closed-content printing behavior.
  • Copy-button click, Enter, and Space copied the exact code through a mocked clipboard and left disclosure state unchanged in all three engines. Explicit icon-target clicks covered open and closed blocks with immediate, task-delayed, and rejected clipboard promises. The immediate icon click reproduces the unwanted Chromium toggle before the default cancellation.
  • Integrated site checks in fix(template): adopt native code-block disclosures hakula.xyz-kiln#92 passed in Chromium, Firefox, and WebKit at mobile dark and desktop light viewports for native toggling, copying, nested state, closed-body focus exclusion, reduced motion, and page overflow. Native disclosure closing animation retains the browser differences documented in fix(content): use native details for stable callouts #86 and refactor(content): share native disclosures with mobile TOC #90.
  • Runtime compatibility: kiln 0.4.0-rc.2 rejects this theme before writing output, while the new 0.4.0-rc.3 binary builds it. Follow-up review found no issues with the version requirement.

Related PRs

@hakula139 hakula139 added the refactor Reorganize the code to be cleaner and easier readable label Oct 2, 2026
@hakula139 hakula139 self-assigned this Oct 2, 2026
@hakula139
hakula139 force-pushed the fix/native-code-disclosures branch from f9492b8 to 99722f3 Compare October 2, 2026 20:40
hakula139 added a commit to hakula139/kiln that referenced this pull request Oct 3, 2026
## Summary

- Use native HTML disclosures for code blocks so they share the callout
and TOC interaction model. Version the changed HTML contract as kiln
`0.4.0-rc.3`, which the paired theme requires.
- **Disclosure state** — render `details.code-block` with a
`summary.code-header`. Default and `{expand}` blocks start open, while
`{collapse}` omits `open`. Preserve titles, IDs, custom classes, syntax
highlighting, and line-limit attributes.
- **Copy accessibility** — give the copy button a persistent
`aria-label="Copy code"` so replacing its text with an icon retains its
accessible name.
- **Syntax reference** — update the generated HTML example and explain
native toggling and theme line limits.

### Related PRs

- Related documentation correction: #84.
- Custom-class escaping: #85.
- [IgnIt shared disclosures](hakula139/IgnIt#94)
- [Draft site
integration](hakula139/hakula.xyz-kiln#92)

## Test plan

- [x] `cargo fmt --all --check`, `cargo build --locked`, and `cargo
clippy --locked --all-targets -- -D warnings` pass in the Nix
development shell.
- [x] `cargo test --locked`: 860 tests pass, including exact disclosure
/ summary markup, accessible copy labels, line-limit overrides for
default, collapse, and expand fences, and escaped custom-class
round-tripping on native markup.
- [x] `pnpm format`, `pnpm lint`, `pnpm spellcheck`, and `git diff
--check` pass.
- [x] `cargo llvm-cov --locked --ignore-filename-regex 'main\.rs'
--summary-only`: 98.46% region coverage and 99.10% line coverage.
- [x] Reviewer subagent: no findings. The coordinated version
requirement was reviewed after the change.
- [x] Paired theme and site checks passed native toggling, copy payloads
and disclosure state, nested disclosures, reduced motion, and
closed-body focus exclusion in Chromium, Firefox, and WebKit.
- [x] Runtime compatibility: released `0.4.0-rc.2` rejects the updated
theme before writing build output, while `0.4.0-rc.3` accepts and builds
it.
@hakula139
hakula139 merged commit ebe36f9 into main Oct 3, 2026
1 check passed
@hakula139
hakula139 deleted the fix/native-code-disclosures branch October 3, 2026 07:19
hakula139 added a commit to hakula139/hakula.xyz-kiln that referenced this pull request Oct 3, 2026
## Summary

- Pin merged kiln `00b3350` and IgnIt `ebe36f9`, then regenerate the
committed stylesheet. Code blocks use native `<details>` / `<summary>`
and share disclosure state, keyboard interaction, and motion rules with
callouts and the mobile TOC.
- Preserve fence collapse / expand options, syntax highlighting, titles,
and line-limit scrolling. Copy clicks cancel native summary activation
before feedback replaces the icon, keeping the disclosure state
unchanged. The icon button retains an accessible name. The renderer
includes custom-class escaping from kiln #85, and the theme requires
kiln `0.4.0-rc.3` so older renderers fail the compatibility check before
producing incompatible markup.

## Verification

- `pnpm build`, `pnpm format`, `pnpm lint`, `pnpm spellcheck`, `nix
flake check`, and `git diff --check` passed on aarch64-darwin. The
compiled stylesheet is in sync.
- The updated pinned kiln `0.4.0-rc.3` Nix build built and indexed all
75 pages, then minified 232 files. Integrated Chromium, Firefox, and
WebKit checks passed at 390px dark and 1440px light for native Enter /
Space toggling, nested disclosure independence, exact copy payloads,
unchanged disclosure state when copying, closed-body focus exclusion,
reduced motion, and no page overflow. Native mouse / Space toggling also
passed with JavaScript disabled in all three engines. Mobile dark and
desktop light screenshots were inspected.
- WebKit skips a summary button in sequential Tab navigation after a
mouse click, also reproduced with plain native details and no theme CSS
or JavaScript. Initial Tab navigation reaches the copy button.
- Native Safari and screen readers were not tested. Production
deployment is checked after merge. Clipboard writes were mocked in
browser checks to verify the exact copied text without accessing the
system clipboard. Comments were excluded from the page checks.

## Related PRs

- [kiln custom-class
escaping](hakula139/kiln#85)
- [kiln renderer](hakula139/kiln#82)
- [IgnIt shared disclosures](hakula139/IgnIt#94)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Reorganize the code to be cleaner and easier readable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant