From a71d1a096d3418d3f989f1e4eb224e19b6d042b8 Mon Sep 17 00:00:00 2001 From: DevEnv nis2-agile Date: Sat, 27 Jun 2026 17:57:21 +0200 Subject: [PATCH] [FIX] V3 polish: spotlight ARIA su top-nav + CSP font segnala-anonimo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - aria-guide "Mostrami dov'è": ora aggancia le voci del menu IN ALTO V3 (data-nav aggiunto in topnav-v3.js su voci dirette + mega-link). Se la voce è in un mega-menu, lo apre (.aria-guide-open) e ci punta lo spotlight; coach "menu in alto". Fallback navigazione invariato. (Prima cercava .sidebar-nav V2.) - segnala-anonimo.html: CSP font-src 'self' → 'self' data: (sbloccato il font data: embeddato, niente più violazione CSP). - Cache-buster: topnav-v3.js/common.js ?v=20260627t, aria-guide.js ?v=20260627t. Co-Authored-By: Claude Opus 4.8 (1M context) --- public/admin/index.html | 4 ++-- public/admin/organizations.html | 4 ++-- public/admin/users.html | 4 ++-- public/architecture.html | 4 ++-- public/assessment.html | 4 ++-- public/assets.html | 4 ++-- public/calendario.html | 4 ++-- public/companies.html | 4 ++-- public/competenze.html | 4 ++-- public/connettori-discovery.html | 4 ++-- public/controlli-periodici.html | 4 ++-- public/cross-analysis.html | 4 ++-- public/dashboard.html | 4 ++-- public/guida.html | 4 ++-- public/incidents.html | 4 ++-- public/integrazioniext.html | 4 ++-- public/internal-audits.html | 4 ++-- public/isms.html | 4 ++-- public/js/aria-guide.js | 29 +++++++++++++++++++++-------- public/js/common.js | 2 +- public/js/topnav-v3.js | 8 +++++--- public/kb.html | 4 ++-- public/management-review.html | 4 ++-- public/misure-requisiti.html | 4 ++-- public/normative.html | 4 ++-- public/organigramma.html | 4 ++-- public/policies.html | 4 ++-- public/raci.html | 4 ++-- public/reports.html | 4 ++-- public/review-schedule.html | 4 ++-- public/risks.html | 4 ++-- public/segnala-anonimo.html | 2 +- public/settings.html | 4 ++-- public/stakeholder-activities.html | 4 ++-- public/stakeholders.html | 4 ++-- public/supply-chain.html | 4 ++-- public/training.html | 4 ++-- public/whistleblowing.html | 4 ++-- public/workflow.html | 4 ++-- 39 files changed, 98 insertions(+), 83 deletions(-) diff --git a/public/admin/index.html b/public/admin/index.html index aa8fe12..d819a87 100644 --- a/public/admin/index.html +++ b/public/admin/index.html @@ -163,9 +163,9 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/public/connettori-discovery.html b/public/connettori-discovery.html index 4c28646..e222f94 100644 --- a/public/connettori-discovery.html +++ b/public/connettori-discovery.html @@ -99,9 +99,9 @@ - + - + diff --git a/public/controlli-periodici.html b/public/controlli-periodici.html index f3105db..fcd8dd4 100644 --- a/public/controlli-periodici.html +++ b/public/controlli-periodici.html @@ -156,9 +156,9 @@ - + - + - + - + - + - + diff --git a/public/guida.html b/public/guida.html index fea85d4..99107a1 100644 --- a/public/guida.html +++ b/public/guida.html @@ -1178,9 +1178,9 @@ - + - + - + - + - + - + - + - + - + - + diff --git a/public/js/aria-guide.js b/public/js/aria-guide.js index 6235701..424daa0 100644 --- a/public/js/aria-guide.js +++ b/public/js/aria-guide.js @@ -79,13 +79,15 @@ '.aria-guide-coach .row{margin-top:8px;display:flex;gap:8px;justify-content:flex-end}', '.aria-guide-coach button{border:none;border-radius:7px;padding:6px 12px;font:600 12px system-ui;cursor:pointer}', '.aria-guide-go{background:#0066CC;color:#fff}.aria-guide-x{background:#1e3a5f;color:#cbd5e1}', + '.nav-item.aria-guide-open .mega,.nav-item.aria-guide-open .mega.no-promo{display:flex!important}', '@media (prefers-reduced-motion:reduce){.aria-guide-spot,.aria-guide-ptr{transition:none;animation:none}}' ].join('\n'); document.head.appendChild(s); } - var _open = null; + var _open = null, _openMega = null; function dismiss() { + if (_openMega) { _openMega.classList.remove('aria-guide-open'); _openMega = null; } if (!_open) return; _open.forEach(function (el) { if (el && el.parentNode) el.parentNode.removeChild(el); }); document.removeEventListener('keydown', onKey, true); @@ -100,19 +102,29 @@ */ function pointTo(nav, label) { dismiss(); - var el = document.querySelector('.sidebar-nav a[data-nav="' + nav + '"]'); - var href = el ? el.getAttribute('href') : (nav + '.html'); - var rect = el && el.getBoundingClientRect(); - // fallback: niente sidebar visibile → vai diretto - if (!el || !rect || rect.width === 0 || rect.height === 0) { window.location.href = href; return false; } - injectCss(); + // V3: menu IN ALTO (data-nav su voci dirette e mega-link). Fallback compat sidebar V2. + var el = document.querySelector('.bar-nav [data-nav="' + nav + '"]') + || document.querySelector('[data-nav="' + nav + '"]') + || document.querySelector('.sidebar-nav a[data-nav="' + nav + '"]'); + var href = el ? (el.getAttribute('href') || (nav + '.html')) : (nav + '.html'); + // Se la voce è dentro un mega-menu (dropdown chiuso), aprilo per renderla visibile. + var megaItem = (el && el.closest && el.closest('.mega')) ? el.closest('.nav-item') : null; + if (megaItem) megaItem.classList.add('aria-guide-open'); + try { window.scrollTo({ top: 0, behavior: 'auto' }); } catch (e) {} + var rect = el && el.getBoundingClientRect(); + // fallback: voce non trovata/visibile → vai diretto + if (!el || !rect || rect.width === 0 || rect.height === 0) { + if (megaItem) megaItem.classList.remove('aria-guide-open'); + window.location.href = href; return false; + } + var ov = document.createElement('div'); ov.className = 'aria-guide-ov'; var spot = document.createElement('div'); spot.className = 'aria-guide-spot'; var ptr = document.createElement('div'); ptr.className = 'aria-guide-ptr'; ptr.innerHTML = ''; var coach = document.createElement('div'); coach.className = 'aria-guide-coach'; - coach.innerHTML = 'Eccolo: ' + (label || nav) + '
È nel menu a sinistra. Vuoi che ti ci porti?' + coach.innerHTML = 'Eccolo: ' + (label || nav) + '
È nel menu in alto. Vuoi che ti ci porti?' + '
'; document.body.appendChild(ov); @@ -137,6 +149,7 @@ coach.querySelector('.aria-guide-go').addEventListener('click', function () { window.location.href = href; }); document.addEventListener('keydown', onKey, true); _open = [ov, spot, ptr, coach]; + _openMega = megaItem; return true; } diff --git a/public/js/common.js b/public/js/common.js index 58cc981..86df077 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -985,7 +985,7 @@ function switchLang(lang) { if (!window.__ariaGuideLoaded) { window.__ariaGuideLoaded = true; var ag = document.createElement('script'); - ag.src = 'js/aria-guide.js?v=20260624f'; + ag.src = 'js/aria-guide.js?v=20260627t'; ag.async = true; document.body.appendChild(ag); } diff --git a/public/js/topnav-v3.js b/public/js/topnav-v3.js index 4acba7e..75438ca 100644 --- a/public/js/topnav-v3.js +++ b/public/js/topnav-v3.js @@ -110,6 +110,8 @@ 'Monitoraggio': 'nav.grp_monitoring', 'Lex e ISO': 'nav.grp_lexiso', 'AI': 'nav.grp_ai', 'Guida': 'nav.grp_guide' }; function i18nAttr(key) { return key ? ' data-i18n="' + key + '"' : ''; } + // data-nav = href senza .html → aggancio per il puntatore guida ARIA (aria-guide.js). + function navAttr(href) { return ' data-nav="' + esc(String(href).replace(/\.html$/, '')) + '"'; } function esc(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { @@ -136,7 +138,7 @@ function renderMega(g) { var colsHtml = g.cols.map(function (col) { var links = col.links.map(function (l) { - return '' + + return '' + '' + '' + esc(l.b) + '' + esc(l.s) + ''; }).join(''); @@ -154,14 +156,14 @@ if (g.href && !g.cols) { // Voce diretta (Dashboard, Calendario) return ''; } // Gruppo con mega-menu. Il link "testa" punta alla prima voce del gruppo. var firstHref = g.cols[0].links[0].href; return '