Fix: pattern regex v-flag, help mobile: TOC accordion not slide-over, search always in TOC
CI / lint (push) Failing after 4s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / security (push) Successful in 9s

This commit is contained in:
2026-06-03 11:13:37 -04:00
parent baba4e9fc7
commit 227e157793
4 changed files with 33 additions and 79 deletions
+1 -1
View File
@@ -465,7 +465,7 @@ const AdminPanel = {
<div class="admin-form-card">
<h3>${title}</h3>
<form id="admin-user-form">
${!isEdit ? '<div class="form-group"><label>Nom d\'utilisateur</label><input type="text" name="username" required pattern="[a-zA-Z0-9_-]{2,32}" placeholder="username"></div>' : ""}
${!isEdit ? '<div class="form-group"><label>Nom d\'utilisateur</label><input type="text" name="username" required pattern="[a-zA-Z0-9_\-]{2,32}" placeholder="username"></div>' : ""}
<div class="form-group"><label>Nom affiché</label><input type="text" name="display_name" value="${isEdit ? user.display_name || "" : ""}"></div>
<div class="form-group"><label>${isEdit ? "Nouveau mot de passe (vide = inchangé)" : "Mot de passe"}</label><input type="password" name="password" ${!isEdit ? 'required minlength="8"' : ""} placeholder="${isEdit ? "Laisser vide pour ne pas changer" : "Min. 8 caractères"}"></div>
<div class="form-group"><label>Rôle</label><select name="role"><option value="user" ${isEdit && user.role === "user" ? "selected" : ""}>Utilisateur</option><option value="admin" ${isEdit && user.role === "admin" ? "selected" : ""}>Admin</option></select></div>
+16 -21
View File
@@ -195,6 +195,9 @@ function initHelpModal() {
modal.classList.add("active");
closeHeaderMenu();
safeCreateIcons();
// Reset TOC to CSS default (mobile: hidden, desktop: visible)
const nav = document.getElementById("help-nav");
if (nav) nav.style.display = '';
if (!helpNavInitialized) {
initHelpNavigation();
helpNavInitialized = true;
@@ -220,9 +223,6 @@ function initHelpNavigation() {
const navList = document.getElementById("help-nav-list");
const nav = document.getElementById("help-nav");
const searchInput = document.getElementById("help-nav-search");
const hamburger = document.getElementById("help-hamburger");
const navClose = document.getElementById("help-nav-close");
const overlay = document.getElementById("help-nav-overlay");
const helpContent = document.querySelector(".help-content");
if (!helpBody || !navList || !nav) return;
@@ -238,23 +238,16 @@ function initHelpNavigation() {
sectionTextCache[s.id] = (s.textContent || '').toLowerCase();
});
// ── Mobile: open/close TOC slide-over ──
function openTOC() {
nav.classList.add("open");
if (overlay) overlay.classList.add("visible");
if (searchInput) setTimeout(() => searchInput.focus(), 150);
document.body.style.overflow = "hidden";
}
function closeTOC() {
nav.classList.remove("open");
if (overlay) overlay.classList.remove("visible");
document.body.style.overflow = "";
}
// ── Mobile: simple display toggle ──
function isMobile() { return window.innerWidth <= 768; }
if (hamburger) hamburger.addEventListener("click", openTOC);
if (navClose) navClose.addEventListener("click", closeTOC);
if (overlay) overlay.addEventListener("click", closeTOC);
function toggleTOC() {
if (nav.style.display === 'none' || nav.style.display === '') {
nav.style.display = 'flex';
if (searchInput) setTimeout(() => searchInput.focus(), 150);
} else {
nav.style.display = 'none';
}
}
// ── Scroll to section ──
function scrollToSection(targetId) {
@@ -262,7 +255,7 @@ function initHelpNavigation() {
if (!section) return;
section.scrollIntoView({ behavior: "smooth", block: "start" });
section.setAttribute("tabindex", "-1");
if (isMobile()) closeTOC();
if (isMobile()) nav.style.display = 'none';
}
// ── Focus the content pane ──
@@ -281,7 +274,9 @@ function initHelpNavigation() {
// ── Focus TOC active link ──
function focusTOC() {
if (isMobile() && !nav.classList.contains("open")) openTOC();
if (isMobile() && (nav.style.display === 'none' || nav.style.display === '')) {
nav.style.display = 'flex';
}
const activeLink = navList.querySelector(".help-nav-link.active:not(.hidden)");
if (activeLink) { activeLink.focus(); return; }
const firstLink = navList.querySelector(".help-nav-link:not(.hidden)");