E4: anche i dialoghi si chiudono quando cambia la pagina, e le prove delle pagine della revisione
Una finestra aperta dal visualizzatore o dalla selezione restava sopra la pagina nuova, con i bottoni di ciò che non si vede più. Con lei le prove che mancavano alle correzioni del giro prima: visualizzatore che segue le analisi fatte altrove, eventi «fermi» che non ricaricano Account e Dashboard, fuoco che resta, ricerca già in coda. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c2d237ec9
commit
c9f6dd0d82
3 files changed
+177
-3
No files matched your search
@@ -356,7 +356,7 @@ async function render() {
|
||||
if (current) {
|
||||
current.frame.destroy();
|
||||
current = null;
|
||||
document.dispatchEvent(new Event('febe:pagina')); // what lies over the page (the viewer) goes with it
|
||||
document.dispatchEvent(new Event('febe:pagina')); // what lies over the page (the viewer, a dialog) goes with it
|
||||
}
|
||||
for (const [key, link] of Object.entries(navLinks)) {
|
||||
const here = route && route.nav === key;
|
||||
|
||||
@@ -37,7 +37,8 @@ const FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:n
|
||||
* Opens a modal dialog over the whole window. build(close) returns { header?, body, footer? } or a node; close(value)
|
||||
* resolves the returned promise. Esc and the veil close with undefined. Focus is trapped and restored.
|
||||
* build may also return onEscape (called first on Esc: returning true means the dialog handled it, say by closing a
|
||||
* list of suggestions, and stays open) and onClose (called once, however the dialog closes).
|
||||
* list of suggestions, and stays open) and onClose (called once, however the dialog closes). A change of the page under
|
||||
* it (a link of a short notice, Back) takes it away as dismissed: its buttons are for what is no longer shown.
|
||||
*/
|
||||
export function dialog({ title, className = '', build, labelledBy, dismissable = true }) {
|
||||
return new Promise((resolve) => {
|
||||
@@ -49,6 +50,7 @@ export function dialog({ title, className = '', build, labelledBy, dismissable =
|
||||
closed = true;
|
||||
veil.remove();
|
||||
document.removeEventListener('keydown', onKey, true);
|
||||
document.removeEventListener('febe:pagina', onPage);
|
||||
if (parts && typeof parts.onClose === 'function') {
|
||||
try {
|
||||
parts.onClose();
|
||||
@@ -94,7 +96,9 @@ export function dialog({ title, className = '', build, labelledBy, dismissable =
|
||||
}
|
||||
}
|
||||
};
|
||||
const onPage = () => close(undefined);
|
||||
document.addEventListener('keydown', onKey, true);
|
||||
document.addEventListener('febe:pagina', onPage);
|
||||
document.body.append(veil);
|
||||
const autofocus = box.querySelector('[autofocus]') || box.querySelector('.contenuto ' + FOCUSABLE) || box.querySelector(FOCUSABLE);
|
||||
if (autofocus) autofocus.focus();
|
||||
|
||||
Reference in new issue
Block a user