Draw the browser scroll marker with the scroll icon

Middle-click scrolling in the built-in browser showed the text arrow
"↕" at 20 px in a 24 px circle. The look of that glyph depends on the
font, and the circle cut it. It also showed only two directions, but
the scroll moves in four.

The marker now uses the four-way scroll icon of Project Management,
which the shared Icon component also gets. The marker has the size of
the Project Management marker: a 26 px circle with a 20 px icon. The
interaction smoke test checks the icon and keeps screenshots in both
themes. Card ac49c9ec.
This commit is contained in:
Knotty Wyvern
2026-10-31 19:06:45 -07:00
parent 33495d2bf7
commit 28661f28bc
4 changed files with 13 additions and 2 deletions
+2 -2
View File
@@ -304,7 +304,7 @@
oninput={() => { if (!composing && textInput.value) { void orderedInput('insertText', { text: textInput.value }); textInput.value = ''; } }} oninput={() => { if (!composing && textInput.value) { void orderedInput('insertText', { text: textInput.value }); textInput.value = ''; } }}
onblur={stopScroll}></textarea> onblur={stopScroll}></textarea>
{#if image && ready && !blank}<img src={image} class:exact={imageBox.exact} style:width={`${imageBox.width}px`} style:height={`${imageBox.height}px`} style:transform={`translate(${imageBox.x}px, ${imageBox.y}px)`} alt={$t("Web page rendered by the browser")} draggable="false" onload={acknowledgeFrame} onerror={acknowledgeFrame}>{/if} {#if image && ready && !blank}<img src={image} class:exact={imageBox.exact} style:width={`${imageBox.width}px`} style:height={`${imageBox.height}px`} style:transform={`translate(${imageBox.x}px, ${imageBox.y}px)`} alt={$t("Web page rendered by the browser")} draggable="false" onload={acknowledgeFrame} onerror={acknowledgeFrame}>{/if}
{#if scrollAnchor}<span class="scroll-anchor" style:left={`${scrollAnchor.x}px`} style:top={`${scrollAnchor.y}px`} aria-hidden="true">↕</span>{/if} {#if scrollAnchor}<span class="scroll-anchor" style:left={`${scrollAnchor.x}px`} style:top={`${scrollAnchor.y}px`} aria-hidden="true"><Icon icon="scroll" /></span>{/if}
</div> </div>
</div> </div>
<style> <style>
@@ -316,7 +316,7 @@
input{flex:1}.profile-choice{max-width:160px;display:flex;align-items:center;gap:var(--rs-menu-icon-gap);cursor:pointer}input:focus-visible,.profile-choice:focus-visible{outline:2px solid var(--rs-focus)} input{flex:1}.profile-choice{max-width:160px;display:flex;align-items:center;gap:var(--rs-menu-icon-gap);cursor:pointer}input:focus-visible,.profile-choice:focus-visible{outline:2px solid var(--rs-focus)}
.surface{position:relative;flex:1;min-height:0;overflow:hidden;outline:none;background:var(--rs-bg)}.surface:focus-visible{box-shadow:inset 0 0 0 1px var(--rs-accent)} .surface{position:relative;flex:1;min-height:0;overflow:hidden;outline:none;background:var(--rs-bg)}.surface:focus-visible{box-shadow:inset 0 0 0 1px var(--rs-accent)}
.browser.blank,.blank .surface{background:transparent} .browser.blank,.blank .surface{background:transparent}
.surface.autoscroll{cursor:all-scroll}.scroll-anchor{position:absolute;transform:translate(-50%,-50%);display:grid;place-items:center;width:24px;height:24px;border:1px solid var(--rs-text);border-radius:50%;background:var(--rs-bg-elevated);color:var(--rs-text);font-size:20px;pointer-events:none;box-shadow:0 1px 4px #0006} .surface.autoscroll{cursor:all-scroll}.scroll-anchor{position:absolute;transform:translate(-50%,-50%);display:grid;place-items:center;width:26px;height:26px;border:1px solid var(--rs-text);border-radius:50%;background:var(--rs-bg-elevated);color:var(--rs-text);pointer-events:none;box-shadow:0 1px 4px #0006}.scroll-anchor :global(svg){width:20px;height:20px;flex-basis:20px}
img{display:block;pointer-events:none;user-select:none;will-change:transform}img.exact{image-rendering:pixelated}.error{margin:0;padding:5px 10px;color:var(--rs-error);font-size:12px} img{display:block;pointer-events:none;user-select:none;will-change:transform}img.exact{image-rendering:pixelated}.error{margin:0;padding:5px 10px;color:var(--rs-error);font-size:12px}
.error p{margin:4px 0}.status,.diagnostics{margin:0;padding:8px 10px;font-size:12px;color:var(--rs-text-dim)} .error p{margin:4px 0}.status,.diagnostics{margin:0;padding:8px 10px;font-size:12px;color:var(--rs-text-dim)}
.reconnect{padding:6px 12px;margin:4px 0;border:1px solid var(--rs-border);border-radius:var(--rs-control-radius);background:var(--rs-bg-elevated);color:var(--rs-text);cursor:pointer} .reconnect{padding:6px 12px;margin:4px 0;border:1px solid var(--rs-border);border-radius:var(--rs-control-radius);background:var(--rs-bg-elevated);color:var(--rs-text);cursor:pointer}
+2
View File
@@ -34,6 +34,8 @@
<path d="m6 9 6 6 6-6" /> <path d="m6 9 6 6 6-6" />
{:else if icon === "chevrons-up-down"} {:else if icon === "chevrons-up-down"}
<path d="m7 15 5 5 5-5M7 9l5-5 5 5" /> <path d="m7 15 5 5 5-5M7 9l5-5 5 5" />
{:else if icon === "scroll"}
<path d="M12 3v5m-3-2 3-3 3 3M12 21v-5m-3 2 3 3 3-3M3 12h5m-2-3-3 3 3 3M21 12h-5m2-3 3 3-3 3" /><circle cx="12" cy="12" r="1" />
{:else if icon === "maximize"} {:else if icon === "maximize"}
<path d="M8 3H3v5M16 3h5v5M21 16v5h-5M8 21H3v-5" /> <path d="M8 3H3v5M16 3h5v5M21 16v5h-5M8 21H3v-5" />
{:else if icon === "minimize"} {:else if icon === "minimize"}
+1
View File
@@ -23,6 +23,7 @@
| "more" | "more"
| "chevron-down" | "chevron-down"
| "chevrons-up-down" | "chevrons-up-down"
| "scroll"
| "up" | "up"
| "down" | "down"
| "maximize" | "maximize"
@@ -162,6 +162,14 @@ await runSmoke('browser/interaction', async ({ browser }) => {
const box = await surface.boundingBox(); const box = await surface.boundingBox();
const x = box.x + 220, y = box.y + 180; const x = box.x + 220, y = box.y + 180;
await page.mouse.click(x, y, { button: 'middle' }); await page.mouse.click(x, y, { button: 'middle' });
// The marker draws the four-way scroll icon, not a text glyph that depends on the font.
const marker = page.locator('.scroll-anchor');
assert.equal(await marker.locator('svg path').count(), 1);
assert.equal(await marker.evaluate(node => node.textContent.trim()), '');
for (const theme of ['light', 'dark']) {
await page.evaluate(async mode => (await import('/src/lib/theme/appearance.ts')).applyAppearance({ theme: 'default', mode }), theme);
await page.screenshot({ path: path.join(output, `scroll-marker-${theme}.png`), clip: { x: x - 30, y: y - 30, width: 60, height: 60 } });
}
await page.mouse.move(x + 90, y + 120); await page.mouse.move(x + 90, y + 120);
await page.waitForTimeout(1500); await page.waitForTimeout(1500);
const scrolled = await evaluate('({x:scrollX,y:scrollY})'); const scrolled = await evaluate('({x:scrollX,y:scrollY})');