Skip to content

Style the reference guide like wicket.apache.org - #1845

Open
dashorst wants to merge 2 commits into
masterfrom
user-guide-site-design
Open

dashorst wants to merge 2 commits into
masterfrom
user-guide-site-design

Conversation

@dashorst

@dashorst dashorst commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Restyles the reference guide in the design of wicket.apache.org and restores syntax highlighting, which the guide has not had: the pom passed <sourceHighlighter>, a parameter asciidoctor-maven-plugin 2.x does not know and ignores, so all of the guide's 500+ listings rendered as plain text. Closes #1844.

The copied 2017 default stylesheet is gone. The plugin's own default stylesheet loads first, and css/wicket.css overrides it through docinfo with the site's tokens, its self-hosted Alegreya and JetBrains Mono fonts and its Rouge colours. The page makes no external requests any more (no Google Fonts, no Font Awesome from cdnjs).

  • Code: Rouge through the source-highlighter attribute. Every listing has a language label and a copy button. In HTML samples, wicket:id and the wicket: tags are marked.
  • Navigation: a masthead with links to the site, the line's Javadoc and the other versions. The table of contents is drawn as the site's ribbon rail, highlights the section in view and opens only that chapter.
  • Blocks: notes and warnings become asides on the tint with an orange rule. Tables get an ink rule above and hairlines between rows.
  • Dark mode follows the system setting.

Before and after

Before After
before after
before after
before after
before after
(no dark mode) after, dark

For review

  • Core: css/wicket.css, js/guide.js, the three docinfo*.html files, and the pom.xml and single.adoc attribute changes.
  • Mechanical: the font files and their licence texts (copied from the site repo), img/wicket-mark.svg, LICENSE and .rat-excludes.
  • Licensing: the fonts are SIL OFL 1.1 and are listed in LICENSE next to the example fonts. The Asciidoctor (MIT) entry and licenses/LICENSE-asciidoctor.txt are removed because the copied stylesheet they covered is gone.
  • Serif body: the body text is serif again, as on the site, which reverses WICKET-6372.
  • Copied tokens: the design tokens are copied from the site's _sass/ribbon/_base.scss and have to be kept in step by hand.
  • PDF: keeps its font icons and is otherwise unchanged.

Tested with mvn clean verify -Pjs-test (green) and mvn -pl wicket-user-guide -Pguide generate-resources. The rendered guide was checked at 1440px and 390px, in light and dark mode, in Chromium.

🤖 Generated with Claude Code

The guide used a 2017 copy of the minified default Asciidoctor
stylesheet, changed only for a sans-serif body (WICKET-6372), and it
had no syntax highlighting at all: the pom passed <sourceHighlighter>,
which asciidoctor-maven-plugin 2.x does not know and silently ignores,
so every listing rendered as plain text. The page also loaded Font
Awesome from cdnjs for the admonition icons.

The guide now keeps the plugin's default stylesheet and adds a small
override through docinfo, in the design of the project site: its
colour tokens, its self-hosted Alegreya and JetBrains Mono fonts (SIL
OFL, licences alongside) and its Rouge colours. Rouge is set through
the source-highlighter attribute. A masthead links to the site, the
Javadoc of the line and the other versions; the table of contents
follows the section being read and opens only that chapter; listings
get a language label and a copy button, and wicket:id and the wicket:
tags are marked in HTML samples; admonitions become asides; a dark
mode follows the system setting. Webfonts and the icon font are off,
so the page makes no external requests.

The body text moves back to a serif, as on the site, which reverses
WICKET-6372. The PDF keeps its font icons and is otherwise unchanged.
The design tokens are copied from the site's _sass/ribbon/_base.scss
and have to be kept in step with it by hand.

LICENSE lists the fonts under the SIL Open Font License next to the
fonts of the examples, and .rat-excludes covers their licence texts.
The Asciidoctor (MIT) entry and licenses/LICENSE-asciidoctor.txt go,
as the copied stylesheet they covered is gone from the source tree.

GitHub issue #1844

Generated-by: Claude Code (Claude Opus 5.5)
@codecov-commenter

codecov-commenter commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.72%. Comparing base (2c719d9) to head (7c743a4).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1845      +/-   ##
============================================
+ Coverage     62.70%   62.72%   +0.01%     
- Complexity    11507    11514       +7     
============================================
  Files          1254     1254              
  Lines         48660    48665       +5     
  Branches       6844     6845       +1     
============================================
+ Hits          30512    30523      +11     
+ Misses        15468    15467       -1     
+ Partials       2680     2675       -5     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@papegaaij papegaaij left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few smaller accessibility points, optional but worth it now that the guide gets an accessibility chapter:

  • There's no skip link past the masthead and the 40-plus links of the TOC, and the generated HTML has no <main> or labelled <nav>. A "Skip to content" link in docinfo-header.html that shows on focus, plus role="main" on #content and role="navigation" with aria-label="Table of contents" on #toc from guide.js, would cover it.
  • All 539 copy buttons are named "Copy". An aria-label built from the language the bar already shows ("Copy Java code") makes a screen reader's button list usable.
  • aria-live on the button itself is announced inconsistently (NVDA often reads it, VoiceOver often doesn't). One visually hidden role="status" element on the page that receives "Copied" is the reliable pattern.

limitations under the License.
-->
<header class="mast">
<a class="mast-brand" href="https://wicket.apache.org/"><img src="./img/wicket-mark.svg" alt="" width="30" height="30"><span>Apache Wicket</span></a>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below 640px wicket.css hides the "Apache Wicket" span with display: none, which hides it from screen readers too. The image has alt="", so on a phone this link has no accessible name and is announced as just "link" (WCAG 2.4.4, 4.1.2). An aria-label names it at every width and matches the visible text on wide screens (2.5.3):

Suggested change
<a class="mast-brand" href="https://wicket.apache.org/"><img src="./img/wicket-mark.svg" alt="" width="30" height="30"><span>Apache Wicket</span></a>
<a class="mast-brand" href="https://wicket.apache.org/" aria-label="Apache Wicket"><img src="./img/wicket-mark.svg" alt="" width="30" height="30"><span>Apache Wicket</span></a>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7c743a4: the brand link has aria-label="Apache Wicket".

Comment on lines +195 to +196
.js-toc #toc li > ul { display: none; }
.js-toc #toc li.is-open > ul { display: block; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A chapter's sections open only by scrolling to it. display: none takes them out of the tab order and away from screen readers, so a keyboard user can't reach "Accessibility → Testing" from the TOC: activating the chapter link moves focus into the content, and Shift+Tab from there doesn't lead back to the TOC. Opening a chapter while focus is inside it fixes that for keyboard users. Tabbing onto a chapter link shows its sections, and the next Tab goes into them:

Suggested change
.js-toc #toc li > ul { display: none; }
.js-toc #toc li.is-open > ul { display: block; }
.js-toc #toc li > ul { display: none; }
.js-toc #toc li.is-open > ul, .js-toc #toc li:focus-within > ul { display: block; }

Two related points:

  • guide.js could set aria-current="location" next to the is-current class (and remove it with the class), so the current entry isn't conveyed by colour alone.
  • Screen readers in browse mode don't always move focus, so :focus-within doesn't fully help them. A disclosure button with aria-expanded per chapter would, at the cost of more script.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7c743a4: :focus-within opens the chapter, and guide.js sets aria-current="location" together with is-current. I left out the disclosure buttons for now. With the skip link, the landmarks and :focus-within, keyboard users can reach every section, so I'd rather see whether browse-mode users actually miss them before adding the extra script.

pre.rouge .se, pre.rouge .sh, pre.rouge .si, pre.rouge .sx, pre.rouge .sr, pre.rouge .ss, pre.rouge .dl { color: var(--code-green); }
pre.rouge .m, pre.rouge .mb, pre.rouge .mf, pre.rouge .mh, pre.rouge .mi, pre.rouge .mo, pre.rouge .mx, pre.rouge .il { color: var(--code-green); }
pre.rouge .nt { color: var(--code-tag); font-weight: 400; }
pre.rouge .na { color: var(--ribbon-deep); }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.nl isn't overridden, so CSS property names in the HTML examples (about 23 of them) keep rouge-github's #990000. On the dark code background that is a contrast of about 1.6:1. The token plays the same role as .na:

Suggested change
pre.rouge .na { color: var(--ribbon-deep); }
pre.rouge .na, pre.rouge .nl { color: var(--ribbon-deep); }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7c743a4: .nl now gets the same colour as .na.

/* ---------------------------------------------------------------- images and other blocks */

.imageblock { margin: 1.5rem 0 2rem; }
.imageblock img { border-radius: 2px; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some images have a transparent background with dark lines and text, img/component-lifecycle.png for one; on the dark page its arrows are nearly invisible. A light background for images in dark mode keeps them readable:

Suggested change
.imageblock img { border-radius: 2px; }
.imageblock img { border-radius: 2px; }
@media (prefers-color-scheme: dark) { .imageblock img { background: #fff; } }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7c743a4: images get a white background in dark mode.

Comment thread wicket-user-guide/pom.xml
<linkcss>true</linkcss>
<source-highlighter>rouge</source-highlighter>
<rouge-css>class</rouge-css>
<webfonts>false</webfonts>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wicket_line has to be bumped by hand at every major release, and adjusted on every cherry-pick to a maintenance line; that's easy to forget, and the masthead and the Javadoc link would then point at the wrong line. It can come from the project version instead. build-helper-maven-plugin is already managed in the root pom; its parse-version goal, added next to the asciidoctor plugin in the guide profile:

<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>build-helper-maven-plugin</artifactId>
	<executions>
		<execution>
			<id>parse-version</id>
			<goals>
				<goal>parse-version</goal>
			</goals>
		</execution>
	</executions>
</plugin>

then provides the major version for the attributes here:

Suggested change
<webfonts>false</webfonts>
<webfonts>false</webfonts>
<wicket_line>${parsedVersion.majorVersion}.x</wicket_line>
<wicket_line_major>${parsedVersion.majorVersion}</wicket_line_major>

I tried it on this branch with mvn -pl wicket-user-guide -Pguide generate-resources: the masthead shows "12.x" and the Javadoc link points at apidocs/12.x. The two attributes in single.adoc can then go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7c743a4: parse-version runs in the guide profile and sets both attributes. The masthead shows 12.x and the Javadoc link points at apidocs/12.x.

Comment on lines +25 to +26
:wicket_line: 12.x
:wicket_line_major: 12

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With wicket_line and wicket_line_major set from the project version in the pom (see the comment there), these two lines can go:

Suggested change
:wicket_line: 12.x
:wicket_line_major: 12

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 7c743a4.

Review of the restyled guide found these gaps, all fixed here:

- The masthead logo link lost its name on phones, where the "Apache
  Wicket" text is hidden. It now carries an aria-label.
- There was no way past the masthead and the long table of contents,
  and no landmarks. A skip link now comes first, #content is the main
  landmark and the table of contents a labelled navigation landmark.
- A chapter's sections were only shown while scrolling through it, so
  keyboard users could not reach them. They also open while focus is
  inside the chapter, and the current entry gets aria-current instead
  of being marked by colour alone.
- The 539 copy buttons were all named "Copy". They are now named after
  their language ("Copy Java code"), and "Copied" is announced through
  a single status region rather than aria-live on each button.
- CSS property names in HTML listings kept rouge-github's colour, which
  is unreadable on the code background.
- Diagrams with a transparent background were nearly invisible in dark
  mode. Images now get a white background there.

The version line in the masthead and the Javadoc link came from
attributes in single.adoc that had to be changed by hand at every
major release and on cherry-picks. They now come from the project
version through build-helper's parse-version goal.

GitHub issue #1844

Generated-by: Claude Code (Claude Opus 5.5)
@dashorst

Copy link
Copy Markdown
Contributor Author

Thanks @papegaaij. 7c743a4 takes all the inline suggestions and the three general points:

  • A skip link is now the first tab stop. #content gets role="main", and #toc gets role="navigation" with aria-label="Table of contents".
  • Copy buttons are named after their language ("Copy Java code", or "Copy code" for listings without one).
  • "Copied" goes to a single visually hidden role="status" element instead of aria-live on each button.

I checked the result in Chromium: 539 buttons and six distinct labels, one status region, and aria-current on the current TOC entry. A focused chapter link shows its sections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Style the reference guide like wicket.apache.org and restore syntax highlighting

3 participants