[FEAT] ARIA puntatore guida "Mostrami dov'è" — spotlight verso il menu (Fase D)
Porting del pattern TRPG (CHANGE_aria_voice_pointer.md) sulla sidebar V2: - public/js/aria-guide.js (nuovo): DESTINATIONS (26 voci menu → keyword IT), matchDestination(question), pointTo(nav,label) = overlay + spotlight pulsante + puntatore animato + coach-mark "Vai →"; Esc/click per chiudere; fallback navigate se la voce non è visibile; rispetta prefers-reduced-motion; self-contained, no inline-CSS. - common-bi.js: data-nav="<href senza .html>" sulle voci sidebar (aggancio puntatore). - common.js: inietta aria-guide.js dopo login; dopo ogni risposta ARIA, se la domanda combacia con una destinazione mostra il bottone "📍 Mostrami dov'è: <voce>". Frontend-only, additivo. Cache-buster common.js/common-bi.js -> 20260624f. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
bafc305503
commit
42529043d3
@@ -981,6 +981,15 @@ function switchLang(lang) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── 1c. Inietta il modulo guida ARIA (puntatore/spotlight verso il menu) ──
|
||||
if (!window.__ariaGuideLoaded) {
|
||||
window.__ariaGuideLoaded = true;
|
||||
var ag = document.createElement('script');
|
||||
ag.src = 'js/aria-guide.js?v=20260624f';
|
||||
ag.async = true;
|
||||
document.body.appendChild(ag);
|
||||
}
|
||||
|
||||
// ── 2. AI Chat FAB viola "ARIA" ─────────────────────────────────────────
|
||||
function ensureFab() {
|
||||
if (document.getElementById('ai-chat-fab')) return;
|
||||
@@ -1165,6 +1174,23 @@ function switchLang(lang) {
|
||||
pending = false;
|
||||
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(history));
|
||||
render();
|
||||
// Guida "Mostrami dov'è": se la domanda combacia con una voce di menu,
|
||||
// offri il puntatore/spotlight verso la sidebar (porting TRPG aria-guide).
|
||||
try {
|
||||
var dest = (window.AriaGuide && AriaGuide.matchDestination) ? AriaGuide.matchDestination(text) : null;
|
||||
if (dest) {
|
||||
var msgsEl = document.getElementById('ai-chat-msgs');
|
||||
if (msgsEl) {
|
||||
var cta = document.createElement('button');
|
||||
cta.type = 'button';
|
||||
cta.style.cssText = 'margin:6px 0 2px;align-self:flex-start;background:#eef5ff;color:#0066CC;border:1px solid #b3d4f5;border-radius:10px;padding:7px 12px;font:600 13px system-ui;cursor:pointer';
|
||||
cta.textContent = '📍 Mostrami dov’è: ' + dest.label;
|
||||
cta.addEventListener('click', function () { if (window.AriaGuide) AriaGuide.pointTo(dest.nav, dest.label); });
|
||||
msgsEl.appendChild(cta);
|
||||
msgsEl.scrollTop = msgsEl.scrollHeight;
|
||||
}
|
||||
}
|
||||
} catch (e) { /* guida opzionale */ }
|
||||
}
|
||||
|
||||
fab.onclick = function () {
|
||||
|
||||
Reference in New Issue
Block a user