From 994f466b77b31a281b24e32cc28fd803661ff61b Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Tue, 17 Nov 2026 23:47:29 +0000 Subject: [PATCH] Qualify drawer height and central tool reflow at constrained widths --- PlotLine.Tests/Browser/investigation-companion.cjs | 4 +++- PlotLine/wwwroot/css/investigation-companion.css | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PlotLine.Tests/Browser/investigation-companion.cjs b/PlotLine.Tests/Browser/investigation-companion.cjs index 0b01bf2e..0904bb98 100644 --- a/PlotLine.Tests/Browser/investigation-companion.cjs +++ b/PlotLine.Tests/Browser/investigation-companion.cjs @@ -18,13 +18,15 @@ const base=live?'https://dev.plotdirector.com':'http://127.0.0.1:5238',out=proce assert((await root.locator('#guidance-finding option').count())>=2);await root.locator('#guidance-finding').selectOption('causality');await p.waitForFunction(()=>document.querySelector('#guidance-finding')?.value==='causality'&&!document.querySelector('#guidance-finding').disabled);await p.reload();await root.locator('#guidance-finding').waitFor();assert.equal(await root.locator('#guidance-finding').inputValue(),'causality');await root.locator('#guidance-finding').selectOption('disconnected');await p.waitForFunction(()=>document.querySelectorAll('.pd-guidance-tool').length===2&&!document.querySelector('#guidance-finding').disabled); await root.getByText('Answers that informed this suggestion',{exact:true}).click();await root.locator('details').getByText('You answered:',{exact:true}).waitFor(); const first=root.locator('.pd-guidance-tool[data-capability=threads]');if(live)assert.equal(await first.locator('select').inputValue(),'Exploring');await first.locator('select').selectOption('Done');await p.waitForFunction(()=>document.querySelector('.pd-guidance-tool[data-capability=threads] select')?.value==='Done'&&!document.querySelector('#guidance-finding').disabled);await p.reload();await first.waitFor();assert.equal(await first.locator('select').inputValue(),'Done'); + await p.route('**/InvestigationCompanion/Update',r=>r.fulfill({status:503,json:{message:'Simulated unconfirmed progress save; previous state retained.'}}));await first.locator('select').selectOption('Skipped');await root.locator('[data-guidance-message]').filter({hasText:'unconfirmed progress'}).waitFor();assert.equal(await first.locator('select').inputValue(),'Done');await p.unroute('**/InvestigationCompanion/Update'); // Right Help opens independently and does not replace guidance. await p.evaluate(()=>PlotLineHelpDrawer.open('plotLines.workspace'));await p.locator('[data-help-content] .help-drawer-article').waitFor();await p.locator('[data-help-pin]').click();assert.equal(await root.getAttribute('data-collapsed'),'false');assert(await p.locator('[data-help-drawer]').isVisible());assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));assert((await p.locator('.plotline-help-main').boundingBox()).width>=560);await snap('Both-panels-expanded'); + await p.locator('[data-guidance-resize]').focus();for(let n=0;n<12;n++)await p.keyboard.press('ArrowRight');await p.setViewportSize({width:1100,height:1000});await p.waitForTimeout(200);assert((await p.locator('.plotline-help-main').boundingBox()).width>=560);assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));if(live)assert(await p.locator('.plot-workspace-controls').evaluate(n=>{const r=n.closest('.plotline-help-main').getBoundingClientRect();return [...n.querySelectorAll('input:not([type=hidden]),select,button')].every(c=>{const b=c.getBoundingClientRect();return b.left>=r.left&&b.right<=r.right;});}));await snap('Both-panels-minimum-centre');await p.setViewportSize({width:1440,height:1000});for(let n=0;n<12;n++)await p.keyboard.press('ArrowLeft'); await root.locator('[data-guidance-collapse]').click();assert.equal(await root.getAttribute('data-collapsed'),'true');await snap('Left-collapsed-tab');await p.reload();await root.locator('[data-guidance-expand]').waitFor();assert.equal(await root.getAttribute('data-collapsed'),'true');await root.locator('[data-guidance-expand]').click();await root.locator('#guidance-finding').waitFor(); if(live){await root.locator('.pd-guidance-tool[data-capability=timeline] form button').click();await p.waitForURL(/\/Timeline/);await root.locator('#guidance-finding').waitFor();assert.equal(c.pages().length,pages);assert.equal(await root.locator('.pd-guidance-tool[data-capability=timeline]').getAttribute('data-selected'),'true');await snap('Second-destination-Timeline');} else{await p.goto(`${base}/Writer/Review?bookId=${w.book}&projectId=${w.project}`);await root.locator('#guidance-finding').waitFor();} await expandRibbon();await p.getByRole('tab',{name:'Writer',exact:true}).click();await p.waitForURL(u=>/\/Writer(?:\/Index)?$/.test(u.pathname));await root.locator('#guidance-finding').waitFor();await expandRibbon();await p.locator('[data-app-back]').click();await p.waitForURL(live?/\/Timeline/:/\/Writer\/Review/);await root.locator('#guidance-finding').waitFor();assert(await first.locator('select').inputValue()==='Done');await snap('Ribbon-Back-retains-guidance'); - await p.setViewportSize({width:800,height:1000});assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await snap('Narrow-in-flow');await p.setViewportSize({width:1440,height:1000}); + await p.setViewportSize({width:800,height:1000});assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));assert((await root.locator('.pd-investigation-panel').boundingBox()).height<=551);await snap('Narrow-in-flow');await p.setViewportSize({width:1440,height:1000}); state=await c.storageState();await c.close();const reopened=await b.newContext({storageState:state,viewport:{width:1440,height:1000}});await reopened.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true}));const q=await reopened.newPage();await q.goto(`${base}/Writer/Explore?projectId=${w.project}&bookId=${w.book}`);await q.locator('#guidance-finding').waitFor();assert.equal(await q.locator('.pd-guidance-tool[data-capability=threads] select').inputValue(),'Done'); await q.goto(`${base}/Writer/Explore?projectId=${w.project}&bookId=${w.otherBook}`);await q.waitForFunction(()=>document.querySelector('[data-guidance-content]')?.textContent.includes('No active investigation'));assert.equal(await q.locator('#guidance-finding').count(),0);assert.equal(await q.locator('[data-investigation-companion]').getAttribute('data-collapsed'),'true'); await q.goto(`${base}/Writer/Explore?projectId=${w.project}&bookId=${w.book}`);await q.locator('#guidance-finding').waitFor(); diff --git a/PlotLine/wwwroot/css/investigation-companion.css b/PlotLine/wwwroot/css/investigation-companion.css index 16d387ab..a1ce68fb 100644 --- a/PlotLine/wwwroot/css/investigation-companion.css +++ b/PlotLine/wwwroot/css/investigation-companion.css @@ -1,12 +1,12 @@ /* Independent left guidance and existing right Help, sharing the application's drawer shell. */ .plotline-help-layout:has([data-investigation-companion]){--context-sticky-top:8px;--investigation-width:320px} .pd-investigation{flex:0 0 var(--investigation-width);width:var(--investigation-width);min-width:0;border-right:1px solid var(--pd-border-subtle);background:var(--pd-surface);color:var(--pd-text)} -.pd-investigation-panel{top:var(--context-sticky-top);max-height:calc(100dvh - var(--context-sticky-top) - 8px)} +.pd-investigation .pd-investigation-panel{top:var(--context-sticky-top);max-height:calc(100dvh - var(--context-sticky-top) - 8px)} .pd-investigation .plotline-help-drawer-header{flex-wrap:wrap;padding:.85rem} .pd-investigation .plotline-help-drawer-content{padding:.85rem;min-height:0;overscroll-behavior:contain} .pd-investigation-tab{display:none} .pd-investigation[data-collapsed=true]{flex-basis:36px;width:36px} -.pd-investigation[data-collapsed=true]>.pd-investigation-panel{display:none} +.pd-investigation[data-collapsed=true]>.pd-investigation .pd-investigation-panel{display:none} .pd-investigation[data-collapsed=true]>.pd-investigation-tab{display:block;position:sticky;top:var(--context-sticky-top);writing-mode:vertical-rl;min-height:140px;width:36px;border:0;background:var(--pd-surface-2);color:var(--pd-text);padding:1rem .5rem;font:inherit;cursor:pointer} .pd-investigation-tab:focus-visible,.pd-investigation-splitter:focus-visible{outline:2px solid var(--pd-focus);outline-offset:-2px} .pd-investigation-splitter{flex:0 0 8px;cursor:col-resize;touch-action:none;background:linear-gradient(90deg,transparent,var(--pd-border-subtle),transparent)} @@ -29,7 +29,7 @@ .plotline-help-layout:has(.pd-investigation[data-collapsed=false]){flex-wrap:wrap} .plotline-help-layout>.pd-investigation[data-collapsed=false]{flex:0 0 100%;width:100%;border-bottom:1px solid var(--pd-border)} .pd-investigation[data-collapsed=false]+.pd-investigation-splitter{display:none} - .pd-investigation-panel{position:relative;top:0;max-height:55dvh} + .pd-investigation .pd-investigation-panel{position:relative;top:0;max-height:55dvh} .plotline-help-layout:has([data-investigation-companion]).help-open>.plotline-help-drawer{flex-basis:36px;min-width:36px;max-width:36px} .plotline-help-layout:has([data-investigation-companion]).help-open>.plotline-help-drawer .plotline-help-drawer-panel{display:none} .plotline-help-layout:has([data-investigation-companion]).help-open>.plotline-help-drawer .plotline-help-collapsed-strip{display:flex;width:36px;writing-mode:vertical-rl;cursor:pointer} @@ -44,3 +44,7 @@ body.reader-focused .pd-investigation,body.reader-focused .pd-investigation-spli .plotline-help-layout.help-open:not(.help-collapsed)>.pd-investigation[data-collapsed=false]{flex-basis:clamp(280px,var(--investigation-width),calc(100% - 816px));width:clamp(280px,var(--investigation-width),calc(100% - 816px))} } .plotline-help-layout:has([data-investigation-companion])>.plotline-help-drawer .plotline-help-drawer-header{flex-wrap:wrap;overflow-wrap:anywhere} + +/* Existing Plot Lines filters must respond to the remaining working width, not only window width. */ +.plotline-help-layout:has([data-investigation-companion]) .plot-control-row{grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr))} +.plotline-help-layout:has([data-investigation-companion]) .plot-control-row>label{min-width:0}