Keep in-page Help usable while Writer goals are unsaved

This commit is contained in:
Nick Beckley 2026-11-03 22:28:26 +00:00
parent 408ea95a09
commit 735a7d86b1
3 changed files with 15 additions and 1 deletions

View File

@ -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.

View File

@ -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();

View File

@ -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;