Navigation
Table of contents
Links to the sections of a long page. nav.kui-toc holds a title and a list of links to headings; <kui-toc> marks the link of the section in view with aria-current="location".
This site uses one at the side of every page from 1280 pixels up. Without JavaScript the links work and nothing is marked.
Examples
Beside a guide
Scroll the page: the link of the section at the top of the window is marked. A nested list indents a section’s parts.
HTML
<div class="kui-sidebar-layout" style="--kui-sidebar-width: calc(var(--kui-space-8) * 4)">
<kui-toc>
<nav class="kui-toc" aria-label="Contents of the guide">
<p class="kui-toc__title">Contents</p>
<ol>
<li><a href="#toc-who">Ko plaća porez</a></li>
<li><a href="#toc-how">How it is calculated</a>
<ol>
<li><a href="#toc-base">The base</a></li>
<li><a href="#toc-rate">The rate</a></li>
</ol>
</li>
<li><a href="#toc-when">Deadlines</a></li>
</ol>
</nav>
</kui-toc>
<div class="kui-prose">
<h4 id="toc-who">Ko plaća porez</h4>
<p>Svako ko je 1. januara vlasnik nepokretnosti u Srbiji: stana, kuće, poslovnog prostora ili zemljišta. Obveznik je i zakupac, ako je zakup duži od godinu dana.</p>
<h4 id="toc-how">How it is calculated</h4>
<p>The municipality sets the value per square metre in each zone. The tax is that value times the area, minus depreciation, times the rate.</p>
<h5 id="toc-base">The base</h5>
<p>The base for a flat is its area in square metres times the average price in its zone, less up to 40 percent for age.</p>
<h5 id="toc-rate">The rate</h5>
<p>Up to 0,4 percent for a person’s own home; higher rates for larger holdings.</p>
<h4 id="toc-when">Deadlines</h4>
<p>The tax is paid in four quarterly instalments, the first by 14 February.</p>
</div>
</div>
States
Every state
The section in view: strong text and an accent line on the left (aria-current="location"). Hover darkens a link. Focus shows the ring. A long heading wraps inside the column.
HTML
<nav class="kui-toc" aria-label="States, contents">
<p class="kui-toc__title">On this page</p>
<ul>
<li><a href="#toc-s1" aria-current="location">In view</a></li>
<li><a href="#toc-s2">Default</a></li>
<li><a href="#toc-s3">Rückerstattungsanspruchsberechnung für Grenzgänger</a></li>
<li><a href="#toc-s4">税务申报的截止日期</a></li>
</ul>
</nav>
Classes and attributes
nav.kui-toc- The table of contents. Give it an aria-label.
.kui-toc__title- A small title above the list; it is text, not a heading.
ol or ul, nested- The links; a nested list indents a section’s parts.
a[aria-current="location"]- The link of the section in view. kui-toc sets it.
kui-toc- Watches the headings the links point at and marks the first one in the upper part of the window.
Keyboard
- Tab
- Moves through the links.
- Enter
- Jumps to the section and moves focus there.
Accessibility
- It is a
<nav>with its own name, separate from the site’s navigation. - The marked link carries
aria-current="location", which screen readers announce as “current location”. - Every link points at an element with that id; give headings a scroll margin so the bar does not cover them.
- The links have the headings’ words, so the list reads as an outline of the page.
Do and do not
Do
- Use it on pages with four or more sections.
- Link only the second and third heading levels.
- Keep it beside the text on a wide screen and leave it out on a phone.
Do not
- Do not repeat the page’s title in the list.
- Do not mark more than one link at a time.
- Do not animate the page’s scroll when a link is pressed if the person asked for reduced motion.