1

Amélioration des boutons tablette

This commit is contained in:
2025-09-17 10:01:03 +02:00
parent ef938b46ba
commit 92ad1acfa1
2 changed files with 56 additions and 38 deletions

View File

@@ -91,56 +91,65 @@ main>header {
.tablet-links { .tablet-links {
display: flex; display: flex;
flex-wrap: wrap;
gap: .5rem; gap: .5rem;
>a, .tablet-link {
summary { display: inline-flex;
width: 32px;
height: 32px;
min-width: 32px;
min-height: 32px;
display: flex;
align-items: center; align-items: center;
justify-content: center; gap: 0.4rem;
padding: 0.4rem 0.8rem;
border-radius: 50%; border-radius: 999px;
background: var(--surface-elevated); background: var(--surface-elevated);
color: var(--text-light); color: var(--text-light);
font-size: 1rem;
text-decoration: none; text-decoration: none;
border: none; border: 1px solid transparent;
outline: none; font-size: 0.85rem;
line-height: 1;
transition: background 0.2s ease, color 0.2s ease; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
} }
>a:hover, .tablet-link:hover,
summary:hover { .tablet-link:focus-visible {
background-color: var(--surface-elevated-hover); background-color: var(--surface-elevated-hover);
color: var(--text-white); color: var(--text-white);
} }
summary { .tablet-link:focus-visible {
list-style: none; outline: 2px solid var(--accent-blue);
cursor: pointer; outline-offset: 3px;
padding: 0; border-color: transparent;
margin: 0;
} }
details[open] summary { .tablet-link:focus:not(:focus-visible) {
outline: none;
}
.tablet-link-icon {
font-size: 1rem;
line-height: 1;
}
.tablet-menu {
position: relative;
display: inline-flex;
flex-direction: column;
align-items: stretch;
}
.tablet-menu[open] .tablet-link {
background-color: var(--border-dark); background-color: var(--border-dark);
color: var(--text-white); color: var(--text-white);
} }
/* Empêche l'effet de flèche par défaut dans WebKit */ .tablet-menu summary {
summary::-webkit-details-marker { list-style: none;
display: none; cursor: pointer;
} }
summary::marker { .tablet-menu summary::-webkit-details-marker,
content: ""; .tablet-menu summary::marker {
display: none;
} }
} }

View File

@@ -24,22 +24,31 @@
<div class="tablet-header"> <div class="tablet-header">
{{ $logo := resources.GetMatch "logo-large.png" }} {{ $logo := resources.GetMatch "logo-large.png" }}
{{ with $logo.Resize "x32" }} {{ with $logo.Resize "x32" }}
<img src="{{ .RelPermalink }}" alt="Logo duit" class="tablet-logo" /> <img src="{{ .RelPermalink }}" alt="Logo du site" class="tablet-logo" />
{{ end }} {{ end }}
<span class="tablet-title">{{ .Title }}</span> <span class="tablet-title">{{ .Title }}</span>
<div class="tablet-links"> <div class="tablet-links" role="navigation" aria-label="Navigation rapide">
<a href="/" title="Retour à la page d'accueil du site"></a> <a class="tablet-link" href="/" title="Retour à la page d'accueil du site">
<span class="tablet-link-icon" aria-hidden="true"></span>
<span class="tablet-link-label">Accueil</span>
</a>
{{ if and (.Parent) (ne .Parent.RelPermalink "/") }} {{ if and (.Parent) (ne .Parent.RelPermalink "/") }}
<a href="{{ .Parent.RelPermalink }}" title="Retour à la section parente"></a> <a class="tablet-link" href="{{ .Parent.RelPermalink }}" title="Retour à la section {{ .Parent.LinkTitle }}">
<span class="tablet-link-icon" aria-hidden="true"></span>
<span class="tablet-link-label">{{ or .Parent.LinkTitle "Section" }}</span>
</a>
{{ end }} {{ end }}
{{ with .TableOfContents }} {{ with .TableOfContents }}
{{ if gt (len (plainify .)) 0 }} {{ if gt (len (plainify .)) 0 }}
<details id="toc" title="Table des matières"> <details id="toc" class="tablet-menu" title="Table des matières">
<summary></summary> <summary class="tablet-link">
<span class="tablet-link-icon" aria-hidden="true"></span>
<span class="tablet-link-label">Sommaire</span>
</summary>
{{ . | safeHTML }} {{ . | safeHTML }}
</details> </details>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>
</div> </div>