Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

fix(view): the roadmap chips keep their scroll through a redraw [N26]

Corey Olsoncd6aa2b316a6
diff --git a/src/cockpit.js b/src/cockpit.js
index 799c8036..00f191bf 100644
--- a/src/cockpit.js
+++ b/src/cockpit.js
@@ -1468,6 +1468,9 @@ function render() {
// and the panel back to its top under a person mid-scroll, so both keep where they were.
const chipsAt = $('roadmap-releases')?.scrollLeft ?? 0, panelAt = $('roadmap-panel')?.scrollTop ?? 0;
$('roadmap').innerHTML = roadmapCards(p, titles);
+ // The mark sets its chip in bold, which widens it, and the fresh row has no mark yet. Restored first, the scroll
+ // would clamp to a row narrower by that bold and leave the chips short of where they were (#452).
+ updateRoadmapPanel();
if ($('roadmap-releases')) $('roadmap-releases').scrollLeft = chipsAt;
if ($('roadmap-panel')) $('roadmap-panel').scrollTop = panelAt;
diff --git a/test/cockpit/roadmap.test.js b/test/cockpit/roadmap.test.js
index 3b6210e7..a8d89d3b 100644
--- a/test/cockpit/roadmap.test.js
+++ b/test/cockpit/roadmap.test.js
@@ -527,7 +527,7 @@ test('the roadmap panel jumps to each release [N26]', {
assert.ok(initial.panel.bottom <= initial.targets[0].rect.top, 'the phone panel sits above the release list');
// A board refresh redraws the Roadmap; the chips stay where the person scrolled them.
const kept = JSON.parse(await chrome.stable("(() => { const row = document.querySelector('#roadmap-releases'); row.scrollLeft = row.scrollWidth; const before = row.scrollLeft; render(); return JSON.stringify([before, document.querySelector('#roadmap-releases').scrollLeft]); })()"));
- assert.ok(kept[0] > 0 && Math.abs(kept[1] - kept[0]) <= 2, `375: a redraw keeps the chips where they were scrolled: ${JSON.stringify(kept)}`);
+ assert.ok(kept[0] > 0 && kept[1] === kept[0], `375: a redraw keeps the chips where they were scrolled: ${JSON.stringify(kept)}`);
await chrome.stable("(() => { document.querySelector('#roadmap-releases').scrollLeft = 0; return true; })()");
}
await proofShot(chrome, 'roadmap-panel-jumps', width);
@@ -563,6 +563,52 @@ test('the roadmap panel jumps to each release [N26]', {
}
});
+test('the roadmap chips keep their scroll through a redraw with wide fonts [N26]', async () => {
+ const executable = chromeExecutable();
+ assert.ok(executable, 'Chrome is required for the Roadmap chip row.');
+ const box = machine();
+ const alpha = project(box, 'roadmap-chips-wide');
+ box.run(alpha.repo, 'add', 'web', 'Next release item', '--specs', 'G1', '--criterion', 'renders');
+ box.run(alpha.repo, 'milestone', 'add', '0.8.7', '--note', 'The next release.', '--items', '1');
+ for (const name of ['0.8.8', '0.8.9', '0.8.10', '0.8.11', '0.8.12', '0.8.13', '0.8.14', '0.8.15', '0.8.16', '0.8.17', '0.8.18', '0.8.19']) {
+ box.run(alpha.repo, 'milestone', 'add', name, '--note', 'Queued after the next release.');
+ }
+ const view = await startView(box);
+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-roadmap-chips-wide-'));
+ let chrome;
+ /** The chips' release names by their text's own width, measured from the glyphs, not the boxes. */
+ const labels = async () => JSON.parse(await chrome.stable("JSON.stringify([...document.querySelectorAll('#roadmap-releases .roadmap-release > span')].map((e) => { const r = document.createRange(); r.selectNodeContents(e); return [e.textContent, r.getBoundingClientRect().width]; }))"));
+ const widths = (list) => JSON.stringify(list.map(([name, width]) => [name, Math.round(width * 100) / 100]));
+ try {
+ chrome = await openSnapshotChrome(executable, view.link.href, profile);
+ await chrome.waitFor('data?.project?.milestones?.length === 13');
+ await chrome.send('Emulation.setDeviceMetricsOverride', { width: 375, height: 900, deviceScaleFactor: 1, mobile: false });
+ await chrome.waitFor('innerWidth === 375');
+ await press(chrome, "document.querySelector('[data-tab=roadmap]')");
+ await chrome.waitFor("document.querySelector('#roadmap-releases [aria-current=location]')");
+ const before = await labels();
+ // The current release's chip is bold, so it is wider than when it is not marked, by an amount that depends on
+ // the face: 2px on macOS, 4px on Linux CI (#452). A letter-spacing in em widens every label by the same share of its
+ // face on every runner, as the toolbar's test does (#445); the forced face, where a machine has it, adds a wider bold.
+ for (const face of ['', 'font-family: Verdana, "DejaVu Sans", "Bitstream Vera Sans", sans-serif !important; ']) {
+ const at = `375/${face ? 'forced face' : 'own face'}`;
+ await chrome.stable(`(() => { const sheet = document.styleSheets[0]; sheet.insertRule('.roadmap-release, .roadmap-release * { ${face}letter-spacing: .12em !important; }', sheet.cssRules.length); return true; })()`);
+ const after = await labels();
+ assert.deepEqual(after.map(([name]) => name), before.map(([name]) => name), `${at}: the same chips, widened`);
+ assert.ok(after.every(([, width], i) => width >= before[i][1] * 1.1), `${at}: every chip's name is at least 10% wider: ${widths(before)} to ${widths(after)}`);
+ // A board refresh redraws the Roadmap with the chips scrolled to their end, where a shorter row would clamp them.
+ const kept = JSON.parse(await chrome.stable("(() => { const row = document.querySelector('#roadmap-releases'); row.scrollLeft = row.scrollWidth; const before = [row.scrollLeft, row.querySelector('[aria-current]')?.dataset.roadmapJump]; render(); const now = document.querySelector('#roadmap-releases'); return JSON.stringify([before, [now.scrollLeft, now.querySelector('[aria-current]')?.dataset.roadmapJump]]); })()"));
+ assert.ok(kept[0][0] > 0 && kept[1][0] === kept[0][0], `${at}: a redraw keeps the chips exactly where they were scrolled: ${JSON.stringify(kept)}`);
+ assert.equal(kept[1][1], kept[0][1], `${at}: the redraw keeps the same chip marked`);
+ await chrome.stable("(() => { const sheet = document.styleSheets[0]; sheet.deleteRule(sheet.cssRules.length - 1); document.querySelector('#roadmap-releases').scrollLeft = 0; return true; })()");
+ }
+ } finally {
+ if (chrome) await closeSnapshotChrome(chrome);
+ rmSync(profile, { recursive: true, force: true });
+ await view.stop();
+ }
+});
+
test('the roadmap panel counts the next release by stage [N26]', {
timeout: 180_000, //budget: hang ceiling for six real item lifecycles and merged receipts before four viewport/theme checks.
}, async (t) => {