diff --git a/Docs/Sprints/2026-11-03-phase2.md b/Docs/Sprints/2026-11-03-phase2.md index 508dad7e..e217589b 100644 --- a/Docs/Sprints/2026-11-03-phase2.md +++ b/Docs/Sprints/2026-11-03-phase2.md @@ -76,3 +76,7 @@ The exact reported whole-page PWA navigation lock has not been reproduced separa - Chapter-goal browser/PWA suite: passed, including a held older save request followed by newer edits. An older acknowledgement leaves the newer draft guarded until its own successful save. - Existing authorised save action retains its normal redirect for non-AJAX callers; the new JSON acknowledgement follows the awaited service save. Verified the repository saves goals by ChapterID, so repeated AJAX saves do not depend on a refreshed generated goal ID. - Read-only Development restart gate verified database identity and found no active background work. Preparing an early verified Writer deployment before the longer visual/data-transfer audits; the gate will be checked again immediately before restart. + +### Guard interaction check — in-page Help + +Before deployment, an added real PWA test reproduced an unnecessary save dialog when the ribbon Help link opened its in-page drawer. The opt-in guard now excludes declared Help/Bootstrap in-page actions; links leaving the page and browser unload remain protected. Extended chapter-goal suite passed in browser/PWA, including Help opening without a save prompt and unchanged draft text. This small static-script correction follows the passing 405-check broader gate; it is not deployed yet. diff --git a/PlotLine.Tests/Browser/writer-goal-navigation.cjs b/PlotLine.Tests/Browser/writer-goal-navigation.cjs index 01585f92..dda21896 100644 --- a/PlotLine.Tests/Browser/writer-goal-navigation.cjs +++ b/PlotLine.Tests/Browser/writer-goal-navigation.cjs @@ -17,6 +17,16 @@ const base='http://127.0.0.1:5238'; const draft=original+' — “Δοκιμή / 日本語”'; await goal.fill(draft); assert(await guarded(),'Unsaved chapter intent protects browser unload'); + if(pwa){ + const help=page.locator('[data-pwa-context-controls] a[data-help-open]'); + const menu=help.locator('xpath=ancestor::details[@data-compact="true"]').last(); + if(await menu.count()&&!(await menu.evaluate(node=>node.open)))await menu.locator(':scope > summary').click(); + await help.click(); + assert.equal(await modal.count(),0,'In-page Help is not a navigation away from the draft'); + assert(await page.locator('[data-help-layout]').evaluate(node=>node.classList.contains('help-open'))); + await page.locator('[data-help-close]').click(); + assert.equal(await goal.inputValue(),draft); + } await leave();await modal.getByRole('button',{name:'Keep editing',exact:true}).click();await modal.waitFor({state:'hidden'}); assert.equal(new URL(page.url()).pathname,'/Writer/Chapter/21');assert.equal(await goal.inputValue(),draft); await page.getByRole('button',{name:'Save chapter goals',exact:true}).click(); diff --git a/PlotLine/wwwroot/js/form-navigation-guard.js b/PlotLine/wwwroot/js/form-navigation-guard.js index 999c3cf2..ae75d9dd 100644 --- a/PlotLine/wwwroot/js/form-navigation-guard.js +++ b/PlotLine/wwwroot/js/form-navigation-guard.js @@ -74,7 +74,7 @@ document.addEventListener('click', async event => { if (event.defaultPrevented || event.button !== 0 || event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || !hasChanges()) return; const link = event.target.closest('a[href]'); - if (!link || link.hasAttribute('download') || (link.target && link.target !== '_self')) return; + if (!link || link.matches('[data-help-open], [data-bs-toggle]') || link.hasAttribute('download') || (link.target && link.target !== '_self')) return; const url = new URL(link.href, location.href); if (!['http:', 'https:'].includes(url.protocol) || link.getAttribute('href').startsWith('#') || (url.origin === location.origin && url.pathname === location.pathname && url.search === location.search && url.hash)) return;