[FIX] Pannello ARIA: chiusura (X+Esc) robusta + niente sovrapposizione ai pallini (stile TRPG)
Aprendo il pannello ARIA ora si nascondono nx-bar (campana/supporto) + ai-chat-fab -> niente overlap; la X e Esc chiudono e ripristinano i pallini. Prima la X era fragile e il pannello copriva i bottoni. Bump common.js?v=20260613d. (TRPG usa ai-assistant.js con stesso pattern toggle/hide.)
This commit is contained in:
+16
-6
@@ -994,6 +994,20 @@ function switchLang(lang) {
|
||||
});
|
||||
}
|
||||
|
||||
// Stile TRPG: aprendo il pannello ARIA nascondiamo gli altri pallini (niente
|
||||
// sovrapposizione); la × / Esc li ripristinano chiudendo.
|
||||
function _siblingFabs(hidden) {
|
||||
['nx-bar', 'ai-chat-fab'].forEach(function (id) {
|
||||
var el = document.getElementById(id);
|
||||
if (el) el.style.display = hidden ? 'none' : 'flex';
|
||||
});
|
||||
}
|
||||
function closePanel() { panel.style.display = 'none'; _siblingFabs(false); }
|
||||
function openPanel() { panel.style.display = 'flex'; _siblingFabs(true); render(); }
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape' && panel.style.display === 'flex') closePanel();
|
||||
});
|
||||
|
||||
function render() {
|
||||
var list = history.map(function (m) {
|
||||
var isUser = m.role === 'user';
|
||||
@@ -1031,9 +1045,7 @@ function switchLang(lang) {
|
||||
+ '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>'
|
||||
+ '</button>'
|
||||
+ '</form>';
|
||||
document.getElementById('ai-chat-close').onclick = function () {
|
||||
panel.style.display = 'none';
|
||||
};
|
||||
document.getElementById('ai-chat-close').onclick = closePanel;
|
||||
document.getElementById('ai-chat-form').onsubmit = onSubmit;
|
||||
var msgs = document.getElementById('ai-chat-msgs');
|
||||
msgs.scrollTop = msgs.scrollHeight;
|
||||
@@ -1077,9 +1089,7 @@ function switchLang(lang) {
|
||||
}
|
||||
|
||||
fab.onclick = function () {
|
||||
var visible = panel.style.display === 'flex';
|
||||
panel.style.display = visible ? 'none' : 'flex';
|
||||
if (!visible) render();
|
||||
if (panel.style.display === 'flex') { closePanel(); } else { openPanel(); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user