Render location hierarchy choices as compact ribbon segments

This commit is contained in:
Nick Beckley 2026-11-03 21:02:25 +00:00
parent 5a969eb6e6
commit 1930007943
5 changed files with 53 additions and 1 deletions

View File

@ -116,3 +116,9 @@ Live protected HTTPS requests redirect through an HTTP login URL. Development ng
Next action for infrastructure review: verify the TLS proxy's forwarded scheme and trusted source addresses, then preserve that scheme at the Development origin with a narrowly trusted configuration. Existing cookies remain Secure, and the edge upgrades HTTP. This is the only deferred confirmed defect. No Production configuration was accessed or modified.
The ee9bbec deployment briefly contained the application-only attempt; final deployment will restore the fully verified application behaviour while retaining all sprint improvements through 2f99a3c. No user data or schema changed.
### B2 follow-up — Literal segmented presentation in the PWA ribbon
Final visual review showed the two mutually exclusive hierarchy choices were using standard ribbon tiles. Added a declarative segmented contribution style so the existing bound buttons render as compact connected label-only segments. Marked the group essential to retain immediate access; source controls, handlers, persisted mode and help remain canonical.
Verification: build passed (0 warnings/errors). New real-Razor browser/PWA regression passed across all four themes, checking connected edges, compact height, keyboard activation, pressed state, source-state synchronisation and restored preference. Existing drag/reparent/relationship browser regression passed. Final full harness and toolbar reruns in progress.

View File

@ -0,0 +1,33 @@
const {chromium}=require('playwright');
const assert=require('node:assert/strict');
(async()=>{const browser=await chromium.launch();try{
for(const pwa of [false,true]){
const context=await browser.newContext({viewport:{width:1440,height:1000}});
if(pwa)await context.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true}));
const page=await context.newPage(),errors=[];page.on('pageerror',e=>errors.push(e.message));
for(const theme of ['modern-light','modern-dark','warm-light','warm-dark']){
await page.goto('http://127.0.0.1:5238/fixture?desktop=Locations');
await page.evaluate(theme=>document.documentElement.dataset.appTheme=theme,theme);
const toolbar=page.locator('.location-hierarchy-toolbar');
assert.equal(await toolbar.isVisible(),!pwa);
const group=pwa?page.locator('[data-pwa-context-controls] .pd-context-group[aria-label="Location hierarchy"]'):toolbar;
const parent=group.getByRole('button',{name:'Change parent',exact:true}),relationship=group.getByRole('button',{name:'Create relationship',exact:true});
await parent.waitFor();await relationship.waitFor();
if(pwa){
assert.equal(await group.locator('.pd-context-segmented').count(),1);
const a=await parent.boundingBox(),b=await relationship.boundingBox();
assert.ok(Math.abs(a.x+a.width-b.x)<2,'Segments join without a gap');
assert.ok(a.height<=36&&b.height<=36,'Compact label-only controls');
assert.equal(await parent.locator('svg').isVisible(),false);
}
await relationship.focus();await page.keyboard.press('Enter');
assert.equal(await parent.getAttribute('aria-pressed'),'false');assert.equal(await relationship.getAttribute('aria-pressed'),'true');
assert.equal(await page.locator('[data-location-drag-action]').inputValue(),'relationship');
await page.reload();
assert.equal(await relationship.getAttribute('aria-pressed'),'true','Persisted preference restores through ribbon binding');
await parent.click();
}
assert.deepEqual(errors,[]);await context.close();
}
console.log('PASS compact connected Location hierarchy segments, keyboard selection, persisted state and browser/PWA fallback in four themes');
}finally{await browser.close();}})().catch(error=>{console.error(error);process.exitCode=1;});

View File

@ -31,7 +31,7 @@
{
<div class="alert alert-danger" role="alert">@error</div>
}
<div class="location-hierarchy-toolbar" data-pwa-context="Location hierarchy">
<div class="location-hierarchy-toolbar" data-pwa-context="Location hierarchy" data-pwa-essential="true" data-pwa-segmented="true">
<span class="fw-semibold">On drop:</span>
<div class="btn-group" role="group" aria-label="Location drag behaviour">
<button type="button" class="btn btn-outline-primary btn-sm" data-location-drag-choice="parent" aria-pressed="true" title="Move a location and its children beneath a new parent; confirmation required.">Change parent</button>

View File

@ -691,3 +691,15 @@ html[data-standalone="true"] .story-calendar-toolbar .button-row {
html[data-standalone="true"] .story-calendar-toolbar .button-row .btn {
width: auto;
}
/* Compact mutually exclusive choices declared by the canonical page controls. */
.pd-shell .pd-context-segmented { align-items:center; gap:0; }
.pd-shell .pd-context-segmented > .pd-ribbon-command {
flex-direction:row; min-width:0; min-height:32px; padding:5px 10px;
border:1px solid var(--pd-border); border-radius:0; box-shadow:none;
background:var(--pd-control); position:relative;
}
.pd-shell .pd-context-segmented > .pd-ribbon-command:first-child { border-radius:5px 0 0 5px; }
.pd-shell .pd-context-segmented > .pd-ribbon-command:last-child { border-radius:0 5px 5px 0; margin-left:-1px; }
.pd-shell .pd-context-segmented > .pd-ribbon-command[aria-pressed=true] { background:var(--pd-selected); border-color:var(--pd-accent); z-index:1; }
.pd-shell .pd-context-segmented > .pd-ribbon-command > svg { display:none; }

View File

@ -356,6 +356,7 @@
if (region.parentElement?.closest('[data-pwa-header], [data-pwa-context]')) continue;
const label = region.dataset.pwaContext || region.dataset.pwaTools || 'Page tools';
if (region.dataset.pwaEssential === 'true') group(label).element.parentElement.dataset.essential = 'true';
if (region.dataset.pwaSegmented === 'true') group(label).element.classList.add('pd-context-segmented');
if (region.dataset.pwaMenuIcon) group(label, 50, region.dataset.pwaCompact === 'true').icon = region.dataset.pwaMenuIcon;
if (region.matches('[data-pwa-help]')) { helpSource ||= region.querySelector(region.matches('h1') ? '[data-help-icon]' : 'h1 [data-help-icon]'); continue; }
const commands = region.matches('a, button') ? [region] : region.matches('[data-pwa-context]') ? [...region.querySelectorAll('a, button')] : [...region.querySelectorAll('a.btn, a.dropdown-item, button.btn, button.dropdown-item')];