favoritter/web/templates/layouts/base.html
Ole-Morten Duesund a9d84a4de8 a11y: fix WCAG 2.2 AA and Uutilsynet audit findings
Tag autocomplete combobox pattern (WCAG 2.1.1, 4.1.2, 4.1.3):
- Add role="combobox", aria-expanded, aria-haspopup to tag input
- Implement arrow key navigation (up/down) through suggestions
- Add Space key support alongside Enter for selecting tags
- Manage aria-activedescendant to track highlighted option
- Add Escape to close suggestions
- Add aria-live="polite" status region announcing suggestion count
- Add aria-selected state on options
- Tag suggestions now have stable IDs for activedescendant

Focus visibility (WCAG 2.4.7):
- Remove outline:none on tag suggestions, replace with visible
  2px solid outline on :focus-visible

Contrast (WCAG 1.4.3):
- Replace opacity:0.5 on disabled rows with muted text color
  and strikethrough on username (maintains 4.5:1 ratio)

Structure and semantics (WCAG 1.3.1):
- Fix heading hierarchy H1→H3 skip in import.html (now H2)
- Replace <nav> misuse for fave actions with div[role="group"]
- Add aria-label="Administrasjonsmeny" to admin dashboard nav
- Wrap admin users table in responsive scrollable region
- Remove redundant "Bilde for:" prefix from image alt text
- Make error page H1 descriptive: "Feil 404: Ikke funnet"
- Add .sr-only utility class for screen-reader-only content
- Add hreflang="en" to English-language external link

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 17:54:24 +02:00

62 lines
2.4 KiB
HTML

{{define "base.html"}}<!DOCTYPE html>
<html lang="nb">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{if .Title}}{{.Title}} — {{end}}{{.SiteName}}</title>
<link rel="stylesheet" href="{{basePath}}/static/vendor/pico.min.css">
<link rel="stylesheet" href="{{basePath}}/static/css/style.css">
{{block "head" .}}{{end}}
</head>
<body>
<a href="#main-content" class="skip-link">Hopp til hovedinnhold</a>
<header class="container">
<nav aria-label="Hovednavigasjon">
<ul>
<li><a href="{{basePath}}/" class="site-title"><strong>{{.SiteName}}</strong></a></li>
</ul>
<ul>
{{if .User}}
<li><a href="{{basePath}}/faves">Mine favoritter</a></li>
<li><a href="{{basePath}}/u/{{.User.Username}}">Profil</a></li>
{{if .User.IsAdmin}}
<li><a href="{{basePath}}/admin">Admin</a></li>
{{end}}
<li>
<form method="POST" action="{{basePath}}/logout" class="inline-form">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<button type="submit" class="outline secondary nav-button">Logg ut</button>
</form>
</li>
{{else}}
<li><a href="{{basePath}}/login">Logg inn</a></li>
<li><a href="{{basePath}}/signup">Registrer</a></li>
{{end}}
</ul>
</nav>
</header>
<main id="main-content" class="container">
{{if .Flash}}
<div class="flash flash-{{.FlashType}}" role="alert">
{{.Flash}}
</div>
{{end}}
{{block "content" .}}{{end}}
</main>
<footer class="container">
<hr>
<p>
<small>
Drevet av <a href="https://kode.naiv.no/olemd/favoritter" target="_blank" rel="noopener">Favoritter</a>
— fri programvare under <a href="https://www.gnu.org/licenses/agpl-3.0.html" target="_blank" rel="noopener" hreflang="en">AGPL-3.0</a>
</small>
</p>
</footer>
<script src="{{basePath}}/static/vendor/htmx.min.js"></script>
<script src="{{basePath}}/static/js/app.js"></script>
</body>
</html>{{end}}