Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

type: every chrome field wears the suite's one field look (#732)

nyblneta8ce70aae71c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e001af45..c3756be3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2762,3 +2762,27 @@ jobs:
# given, refuses a malformed value, and never emits a placeholder: the
# platforms cache these files, so a wrong one is worse than none.
run: node scripts/test-well-known.ts
+
+ type-fields-browser:
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 24
+ - name: Install browser test runtime
+ # Pinned outside app packages: browser automation is not shipped in documents.
+ run: |
+ npm install --prefix "$RUNNER_TEMP/bento-browser" --no-package-lock --ignore-scripts [email protected]
+ "$RUNNER_TEMP/bento-browser/node_modules/.bin/playwright" install --with-deps chromium
+ echo "PLAYWRIGHT_MODULE=$RUNNER_TEMP/bento-browser/node_modules/playwright/index.mjs" >> "$GITHUB_ENV"
+ - name: Build the tested standalone document
+ run: |
+ npm ci --prefix type
+ npm run build:single --prefix type
+ - name: Every chrome field wears the suite's one field look, light and dark
+ # The THE FIELD block copied from slides: border, fill, radius, height and
+ # the focus ring, measured on twelve real surfaces, plus a planted
+ # browser-default field that must be flagged.
+ run: node scripts/test-type-fields-browser.mjs
diff --git a/scripts/test-type-fields-browser.mjs b/scripts/test-type-fields-browser.mjs
new file mode 100644
index 00000000..ce7c5a37
--- /dev/null
+++ b/scripts/test-type-fields-browser.mjs
@@ -0,0 +1,245 @@
+// SPDX-License-Identifier: MIT
+// Copyright (c) 2026 The Bento authors
+// Every text field, select and textarea in type's chrome wears the ONE field look.
+//
+// npm run build:single --prefix type && node scripts/test-type-fields-browser.mjs
+//
+// A port of scripts/test-slides-fields-browser.mjs — the same measurement and
+// the same verdicts, over type's shell, surfaces and containers. The rule
+// under test is the `THE FIELD` block in type/src/styles.css, copied from
+// slides (docs/DECISIONS.md 2026-10-17, "the suite's one field look").
+//
+// WHAT THIS PROVES, measured in the packaged document, in light AND dark theme:
+// 1. every visible field — the properties panel (paragraph styles, page
+// layout, the Review panel), the image panel, About, find and replace,
+// the link popover, the comment box, the live-session name, Insert a
+// field, Import BibTeX, Insert citation, and mail merge on a two-sheet
+// workbook — has a 1px SOLID border in the computed --line colour, a
+// --field fill, a 6px radius, and (single-line fields) a 26px height. Two
+// type fields shipped in the browser's own dress (an unclassed select:
+// the Review panel's "Display" and mail merge's "Sheet"), and the rest
+// each restated the look with their own radius (6, 7 or 8px) and padding;
+// 2. a focused field shows the amber ring: a 2px solid --accent-text outline
+// (type's name for slides' --accent-ink; type's own --accent-ink is text
+// ON the accent, near-black in dark theme, and would hide the ring);
+// 3. each surface really opened — a floor on how many fields it shows — so a
+// menu that silently failed to open cannot pass by having no fields;
+// 4. the check itself works: a field with its author styles reverted (the
+// browser's dress) is planted in the page and must be flagged.
+const { chromium } = await import(process.env.PLAYWRIGHT_MODULE || 'playwright')
+import { writeFileSync, mkdtempSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+
+let checks = 0
+let failures = 0
+function ok(cond, msg) {
+ checks++
+ if (!cond) { failures++; console.log(` FAIL ${msg}`) } else console.log(` ok ${msg}`)
+}
+
+const SHELL = new URL('../type/dist-single/Bento_Type.bento.html', import.meta.url).href
+// A two-sheet bento/dash workbook, as dash's importDelimited writes one: mail
+// merge shows its Sheet picker only when there is a choice to make.
+const DASH = {"format":"bento/dash","version":1,"policy":"bento-dash-1","docId":"doc-115b3d47","title":"Two sheets","sheets":[{"id":"s-a","name":"Recipients","kind":"table","rids":[[1,2]],"columns":[{"id":"name","name":"Name","type":"text"},{"id":"owed","name":"Owed","type":"number","parsed":"dot"}],"data":{"name":{"enc":"raw","v":["Ada","Grace"]},"owed":{"enc":"raw","v":[1,2]}},"steps":[{"op":"import","from":"pasted","at":"","rows":2}]},{"id":"s-b","name":"Others","kind":"table","rids":[[1,1]],"columns":[{"id":"name","name":"Name","type":"text"},{"id":"plan","name":"Plan","type":"text"}],"data":{"name":{"enc":"raw","v":["Alan"]},"plan":{"enc":"raw","v":["Gold"]}},"steps":[{"op":"import","from":"pasted","at":"","rows":1}]}],"measures":{"Weighted pipeline":{"name":"Weighted pipeline","expr":"SUM(value * prob)","grain":"sheet-pipeline","additive":true,"unit":"GBP","desc":"Open value discounted by probability. Won counts in full; lost counts nothing."}},"theme":{"background":"#FFFFFF","color":"#1E2A3A","accent":"#F7A600","fontFamily":"ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif"}}
+const dir = mkdtempSync(join(tmpdir(), 'bento-type-fields-'))
+const DASH_FILE = join(dir, 'two-sheets.bento.html')
+writeFileSync(DASH_FILE, '<!DOCTYPE html>\n<html><head><script type="application/bento+json" id="bento-doc">\n'
+ + JSON.stringify(DASH).replace(/</g, '\\u003c') + '\n</scr' + 'ipt></head><body></body></html>')
+const PNG_FILE = join(dir, 'px.png')
+writeFileSync(PNG_FILE, Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==', 'base64'))
+
+// Every visible field on the page, with what the rule governs. Native widgets
+// (checkbox, radio, range, file) keep the platform look and are skipped.
+function measure(scope) {
+ const root = getComputedStyle(document.documentElement)
+ const probe = document.createElement('div')
+ document.body.appendChild(probe)
+ const resolve = (v) => { probe.style.color = v; return getComputedStyle(probe).color }
+ const tok = { line: resolve(root.getPropertyValue('--line')), field: resolve(root.getPropertyValue('--field')), ring: resolve(root.getPropertyValue('--accent-text')) }
+ probe.remove()
+ const out = []
+ for (const el of document.querySelectorAll('input, textarea, select')) {
+ const r = el.getBoundingClientRect()
+ const s = getComputedStyle(el)
+ if (!r.width || !r.height || s.visibility === 'hidden') continue
+ const type = el.tagName === 'INPUT' ? el.type : el.tagName.toLowerCase()
+ if (['checkbox', 'radio', 'range', 'file', 'hidden'].includes(type)) continue
+ // the deliberate exception: the ghost document title in the bar (boxless
+ // at rest), slides' .ed-title counterpart. Nothing inside the document
+ // page is chrome, and none is measured.
+ if (el.matches('.t-doctitle') || el.closest('#paper')) continue
+ const sides = ['Top', 'Right', 'Bottom', 'Left']
+ const name = (el.className && `.${String(el.className).trim().split(/\s+/)[0]}`) || el.closest('[class]')?.className.split(' ')[0] || ''
+ out.push({
+ id: `${type} ${name}${el.placeholder ? ` "${el.placeholder}"` : ''}`.trim(),
+ type,
+ styles: sides.map((x) => s[`border${x}Style`]),
+ widths: sides.map((x) => s[`border${x}Width`]),
+ colors: sides.map((x) => s[`border${x}Color`]),
+ bg: s.backgroundColor,
+ radius: s.borderTopLeftRadius,
+ h: +r.height.toFixed(1),
+ planted: el.hasAttribute('data-planted'),
+ inScope: !scope || !!el.closest(scope),
+ })
+ }
+ return { tok, fields: out }
+}
+
+function problems(f, tok) {
+ const p = []
+ if (f.styles.some((x) => x === 'inset' || x === 'outset')) p.push(`${f.styles[0]} border (browser default)`)
+ else if (f.styles.some((x) => x !== 'solid')) p.push(`border ${f.styles.join('/')}`)
+ if (f.widths.some((w) => w !== '1px')) p.push(`border ${f.widths.join('/')}`)
+ if (f.colors.some((c) => c !== tok.line)) p.push(`border ${f.colors[0]} ≠ --line ${tok.line}`)
+ if (f.bg !== tok.field) p.push(`fill ${f.bg} ≠ --field ${tok.field}`)
+ if (f.radius !== '6px') p.push(`radius ${f.radius}`)
+ if (f.type !== 'textarea' && Math.abs(f.h - 26) > 0.5) p.push(`height ${f.h}`)
+ return p
+}
+
+// each surface gets a fresh page; `open` brings it up, and `min` is the floor
+// on how many fields it shows INSIDE `scope` — proof the surface opened at
+// all, since the panel's fields are on the page whatever else is open
+const selectText = async (p) => {
+ const bb = await p.locator('#paper p[data-kind=para]').first().boundingBox()
+ await p.mouse.click(bb.x + 4, bb.y + bb.height / 2)
+ await p.keyboard.press('Home')
+ for (let i = 0; i < 8; i++) await p.keyboard.press('Shift+ArrowRight')
+}
+const menu = async (p, btn, label) => {
+ await p.click('#' + btn)
+ await p.waitForTimeout(150)
+ await p.getByRole('button', { name: label }).or(p.getByRole('menuitem', { name: label })).first().click()
+}
+const SURFACES = [
+ { name: 'properties panel (Review, page layout)', scope: '#propsPanel', min: 8, open: async () => {} },
+ { name: 'paragraph styles', scope: '.t-sty-row', min: 2, open: (p) => selectText(p) },
+ { name: 'image panel', scope: '#propsPanel', min: 2, open: async (p) => {
+ p.__file = PNG_FILE
+ await selectText(p); await menu(p, 'insertMenuBtn', 'Picture'); await p.waitForTimeout(500)
+ const bb = await p.locator('#paper [data-kind=image]').first().boundingBox()
+ await p.mouse.click(bb.x + bb.width / 2, bb.y + bb.height / 2)
+ await p.waitForFunction(() => [...document.querySelectorAll('#propsPanel input')].some((i) => /Alt/.test(i.previousElementSibling?.textContent || '')))
+ } },
+ { name: 'About', scope: '.t-dlg', min: 2, open: (p) => p.click('#mark') },
+ // through Navigate → Results, where the find box lives: the toolbar button
+ // and ⌘F do not reach it on main (reported separately; this rig is about
+ // how the fields look, not how they are reached)
+ { name: 'find and replace', scope: '.t-find', min: 2, open: async (p) => {
+ await p.click('.t-tabs button[data-tab="navigate"]'); await p.click('button[data-view="results"]')
+ } },
+ { name: 'link popover', scope: '.t-link-pop', min: 1, open: async (p) => { await selectText(p); await p.click('#tool-link') } },
+ { name: 'comment box', scope: '.acts', min: 1, open: async (p) => { await selectText(p); await p.click('#tool-comment') } },
+ { name: 'live-session name', scope: '.tc-name-row', min: 1, open: (p) => p.click('.tc-share-btn') },
+ { name: 'Insert a field', scope: '.t-dlg', min: 1, open: async (p) => { await selectText(p); await menu(p, 'insertMenuBtn', 'Field') } },
+ { name: 'Import BibTeX', scope: '.t-dlg', min: 1, open: (p) => menu(p, 'more', 'Import BibTeX') },
+ { name: 'Insert citation', scope: '.t-dlg', min: 2, open: async (p) => {
+ await menu(p, 'more', 'Import BibTeX')
+ await p.fill('.t-cite-paste', '@article{knuth84, author={Donald Knuth}, title={Literate Programming}, year={1984}, journal={The Computer Journal}}')
+ await p.getByRole('button', { name: 'Import', exact: true }).click(); await p.waitForTimeout(200)
+ await selectText(p); await p.keyboard.press('ArrowRight'); await menu(p, 'insertMenuBtn', 'Citation')
+ } },
+ { name: 'mail merge, two sheets', scope: '.t-dlg', min: 2, open: async (p) => {
+ p.__file = DASH_FILE
+ await menu(p, 'more', 'Mail merge'); await p.waitForTimeout(600)
+ await p.locator('.t-dlg select').first().waitFor()
+ } },
+]
+
+// the panel's collapsible sections, opened so fields behind them are measured
+const expandAll = (p) => p.evaluate(() => { for (const h of document.querySelectorAll('#propsPanel details:not([open])')) h.open = true })
+
+const browser = await chromium.launch({ executablePath: process.env.CHROME_PATH, headless: true })
+try {
+ for (const theme of ['light', 'dark']) {
+ console.log(`\n${theme} theme\n`)
+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } })
+ await ctx.addInitScript((th) => { try { localStorage.setItem('bento-theme', th) } catch {} }, theme)
+ await ctx.route(/^https?:/, (r) => r.abort())
+ const fresh = async () => {
+ const p = await ctx.newPage()
+ p.on('dialog', (d) => d.accept('Probe').catch(() => {}))
+ p.on('filechooser', (fc) => { if (p.__file) fc.setFiles(p.__file).catch(() => {}) })
+ // ONE known error is tolerated, by its exact text: the shell loader's
+ // synchronous inline path rejects type's bundle (Vite's lazy-import helper
+ // carries import.meta.url) and the loader falls back to its blob import —
+ // the app boots either way. Reported separately; any OTHER error fails.
+ p.on('pageerror', (e) => { if (!/Cannot use 'import\.meta' outside a module/.test(e.message)) ok(false, `no page error (${e.message})`) })
+ await p.goto(SHELL)
+ await p.waitForFunction(() => window.bento?.doc && document.querySelector('#paper p[data-kind=para]'))
+ return p
+ }
+
+ const p0 = await fresh()
+ ok(await p0.evaluate(() => document.documentElement.dataset.theme) === theme, `the page is in ${theme} theme`)
+ await p0.close()
+
+ let total = 0
+ let focusable = null
+ for (const s of SURFACES) {
+ const p = await fresh()
+ let res
+ try {
+ await s.open(p)
+ await p.waitForTimeout(250)
+ await expandAll(p)
+ res = await p.evaluate(measure, s.scope)
+ } catch (e) {
+ ok(false, `${s.name}: opens (${e.message.split('\n')[0]})`)
+ await p.close()
+ continue
+ }
+ const bad = res.fields.map((f) => [f, problems(f, res.tok)]).filter(([, pr]) => pr.length)
+ total += res.fields.length
+ const own = res.fields.filter((f) => f.inScope).length
+ ok(own >= s.min && bad.length === 0,
+ `${s.name}: ${own} field(s) of its own (floor ${s.min}), all ${res.fields.length} on the page in the field look` +
+ bad.map(([f, pr]) => `\n ${f.id}: ${pr.join('; ')}`).join(''))
+ if (s.name === 'comment box') focusable = p
+ else await p.close()
+ }
+ ok(total >= 60, `${total} fields measured across ${SURFACES.length} surfaces`)
+
+ // 2. the focus ring, on each kind of field — on the comment page, which
+ // has no modal dialog holding focus and carries all four kinds
+ const p = focusable
+ for (const sel of ['input[type="text"]', 'input[type="number"]', 'select', 'textarea']) {
+ const ring = await p.evaluate((sel) => {
+ const el = [...document.querySelectorAll(sel)].find((e) => e.getBoundingClientRect().width && !e.matches('.t-doctitle') && !e.closest('#paper'))
+ if (!el) return null
+ el.focus({ focusVisible: true })
+ const s = getComputedStyle(el)
+ const probe = document.createElement('div')
+ probe.style.color = getComputedStyle(document.documentElement).getPropertyValue('--accent-text')
+ document.body.appendChild(probe)
+ const want = getComputedStyle(probe).color
+ probe.remove()
+ return { style: s.outlineStyle, width: s.outlineWidth, color: s.outlineColor, want, focusVisible: el.matches(':focus-visible') }
+ }, sel)
+ ok(ring && ring.focusVisible && ring.style === 'solid' && ring.width === '2px' && ring.color === ring.want,
+ `focused ${sel} shows the amber ring (${ring ? `${ring.width} ${ring.style} ${ring.color}, want ${ring.want}` : 'none found'})`)
+ }
+
+ // 4. the check catches the browser's dress: plant a field whose author
+ // styles are reverted, and it must come back with problems
+ const planted = await p.evaluate(() => {
+ const el = document.createElement('select')
+ el.setAttribute('data-planted', '')
+ el.style.all = 'revert'
+ el.innerHTML = '<option>x</option>'
+ document.querySelector('#propsPanel, body').appendChild(el)
+ return true
+ }) && (await p.evaluate(measure))
+ const pf = planted.fields.find((f) => f.planted)
+ const pr = pf ? problems(pf, planted.tok) : []
+ ok(pf && pr.some((x) => /browser default|fill|radius|border/.test(x)), `a browser-dressed field is flagged (${pr.join('; ') || 'not flagged'})`)
+ await p.close()
+ await ctx.close()
+ }
+} finally {
+ await browser.close()
+}
+console.log(`\n${checks - failures}/${checks} checks passed`)
+if (failures) process.exit(1)
diff --git a/type/src/collab.css b/type/src/collab.css
index 1f722749..7dfcf715 100644
--- a/type/src/collab.css
+++ b/type/src/collab.css
@@ -47,11 +47,7 @@ button.tc-share-btn.live::before { background: var(--good); }
.tc-name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tc-name-row label { color: var(--muted); font-size: 11.5px; }
-.tc-name-row input {
- font: inherit; font-size: 12.5px; width: 120px;
- border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px;
- background: var(--chrome); color: var(--ink);
-}
+.tc-name-row input { width: 120px; }
.tc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 5px; }
.tc-label:first-child { margin-top: 0; }
diff --git a/type/src/comments.css b/type/src/comments.css
index f113617e..f4082b8b 100644
--- a/type/src/comments.css
+++ b/type/src/comments.css
@@ -10,18 +10,7 @@
/* ---- "You" name field, About dialog ------------------------------------ */
-.t-about-name-input {
- width: 100%;
- max-width: 220px;
- font: inherit;
- font-size: 12px;
- padding: 4px 7px;
- border: 1px solid var(--line);
- border-radius: 7px;
- background: var(--field, var(--chrome));
- color: var(--ink);
-}
-.t-about-name-input:focus { border-color: var(--blue, var(--accent)); outline: none; }
+.t-about-name-input { width: 100%; max-width: 220px; }
/* ---- per-message edit/delete -------------------------------------------
Small ghost buttons beside a message's byline, shown only on a message
@@ -48,20 +37,11 @@
}
.t-cmt-msgbtn:hover { background: var(--chrome-2); color: var(--ink); border-color: var(--line); }
-/* In-place edit box — sized and styled to match the reply textarea
- (.acts textarea in styles.css) so a message being edited doesn't look
- like a different control from the one you'd reply with. */
+/* In-place edit box — the suite's field look (styles.css THE FIELD), sized
+ like the reply textarea so a message being edited doesn't look like a
+ different control from the one you'd reply with. */
.t-cmt-edit {
display: block;
width: 100%;
- box-sizing: border-box;
- font: inherit;
- font-size: 12px;
- padding: 5px 7px;
margin-top: 3px;
- border: 1px solid var(--line);
- border-radius: 6px;
- background: var(--field, var(--chrome));
- color: var(--ink);
- resize: vertical;
}
diff --git a/type/src/docstyles.css b/type/src/docstyles.css
index 13ff2806..66545613 100644
--- a/type/src/docstyles.css
+++ b/type/src/docstyles.css
@@ -21,10 +21,6 @@
.t-sty-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.t-sty-row > span:first-child { flex: 1 1 auto; font-size: 12.5px; color: var(--muted); }
.t-sty-row > :last-child { flex: 0 0 auto; }
-.t-sty-color {
- width: 34px; height: 26px; padding: 2px; box-sizing: border-box;
- border: 1px solid var(--line); border-radius: 7px; background: var(--field);
- cursor: pointer;
-}
+.t-sty-color { width: 34px; cursor: pointer; }
.t-sty-actions { display: flex; gap: 6px; margin: 8px 0 2px; flex-wrap: wrap; }
.t-sty-actions .t-btn { flex: 1 1 auto; white-space: nowrap; }
diff --git a/type/src/merge.ts b/type/src/merge.ts
index 10c2bcb8..51c2d99d 100644
--- a/type/src/merge.ts
+++ b/type/src/merge.ts
@@ -443,6 +443,7 @@ export async function openMerge(ctx: FeatureContext): Promise<void> {
const lab = document.createElement('span');
lab.textContent = t('Sheet');
const sel = document.createElement('select');
+ sel.className = 't-select';
src.sheets.forEach((s, i) => {
const o = document.createElement('option');
o.value = String(i);
diff --git a/type/src/review.ts b/type/src/review.ts
index f81b8c6d..2a3e3051 100644
--- a/type/src/review.ts
+++ b/type/src/review.ts
@@ -293,6 +293,7 @@ function buildViewPanel(host: HTMLElement, ctx: FeatureContext): void {
const label = document.createElement('span');
label.textContent = t('Display');
const sel = document.createElement('select');
+ sel.className = 't-select';
const OPTIONS: Array<[TrackView, string]> = [
['all', t('All markup')],
['final', t('No markup')],
diff --git a/type/src/styles.css b/type/src/styles.css
index 1b55f84b..9bee720a 100644
--- a/type/src/styles.css
+++ b/type/src/styles.css
@@ -68,6 +68,7 @@
--muted: #5b6472;
--accent: #f7a600;
--accent-ink: #7a5200;
+ --accent-text: #7a5200; /* accent-coloured TEXT on chrome (slides' --accent-ink) */
--blue: #5b8def;
--field: #ffffff; /* form-control surface — CHROME, not paper */
--grid-dot: #d5dbe4;
@@ -88,6 +89,7 @@
--muted: #8b95a4;
--accent: #f7a600;
--accent-ink: #3a2a00; /* text ON the accent, so it flips */
+ --accent-text: #f0b74e; /* accent-coloured TEXT on chrome (slides' --accent-ink) */
--blue: #7aa5f5; /* lifted: #5b8def is too dark to read here */
--field: #12151a;
--grid-dot: #2b313b;
@@ -142,8 +144,7 @@ html, body {
.t-props .t-row > :last-child { flex: 0 0 auto; }
.t-toggles { display: flex; gap: 2px; margin: 6px 0; flex-wrap: wrap; }
.t-toggles .t-btn { min-width: 30px; min-height: 28px; padding: 4px 7px; }
-.t-field { width: 68px; font: inherit; font-size: 12.5px; color: var(--ink);
- background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; }
+.t-field { width: 68px; }
.t-field-wide { width: 130px; }
.t-props .t-note { margin: 4px 0 8px; }
.t-side { background: var(--chrome); border-inline-end: 1px solid var(--line); overflow: auto; }
@@ -277,11 +278,49 @@ html, body {
.t-primary { background: var(--ink); color: var(--chrome); padding: 6px 12px; }
.t-primary:hover { background: var(--ink-2); }
-.t-select {
- font: inherit; font-size: 13px; color: var(--ink-2);
- background: var(--field); border: 1px solid var(--line);
- border-radius: 8px; padding: 5px 8px; cursor: pointer;
+/* ————— THE FIELD — one look for every text field, select and textarea ———————
+ The suite's reference: dash, spaces and type copy this block as it stands.
+ Every chrome field gets it with no class to remember, so a new field cannot
+ come out in the browser's own dress — the grey inset 2px border, square
+ corners, and in dark theme a dark-grey fill nobody chose (five of slides'
+ fields had exactly that, each with its own rule that forgot one property).
+
+ :where() keeps the specificity at ZERO, so a context rule that only sizes a
+ field (width, flex, font-weight) layers on top without restating the look,
+ and a field that is deliberately not a box (the ghost title, the password
+ gate's own card) overrides it with an ordinary class. The ring sits ON the
+ border (offset -1px), so no scroll container can clip it. Checkboxes,
+ radios, ranges and file pickers keep their native controls. Guarded by
+ scripts/test-slides-fields-browser.mjs.
+
+ bento/type: copied from slides as it stands (docs/DECISIONS.md 2026-10-17,
+ "the suite's one field look"). One token is mapped: slides' --accent-ink is
+ accent-coloured TEXT on chrome, which type calls --accent-text, because
+ type's --accent-ink is text ON the accent (dark in dark theme, so the ring
+ would vanish). Guarded here by scripts/test-type-fields-browser.mjs. */
+:where(input:not([type='checkbox'], [type='radio'], [type='range'], [type='file'], [type='color'], [type='button'], [type='submit'], [type='reset'], [type='image'], [type='hidden']), select, textarea) {
+ box-sizing: border-box;
+ height: 26px;
+ padding: 0 6px;
+ font: inherit;
+ font-size: 12.5px;
+ color: var(--ink);
+ background: var(--field);
+ border: 1px solid var(--line);
+ border-radius: 6px;
}
+:where(textarea) { height: auto; padding: 6px 8px; line-height: 1.5; resize: vertical; }
+:where(input[type='color']) {
+ box-sizing: border-box;
+ height: 26px;
+ padding: 1px 2px;
+ background: var(--field);
+ border: 1px solid var(--line);
+ border-radius: 6px;
+}
+:where(input, select, textarea):focus-visible { outline: 2px solid var(--accent-text); outline-offset: -1px; }
+
+.t-select { cursor: pointer; }
/* the ⋯ menu — secondary actions, off the bar but one click away */
.t-menuwrap { position: relative; }
@@ -541,12 +580,7 @@ html, body {
::highlight(t-find-cur) { background-color: var(--find-cur); color: var(--find-ink); }
.t-find { display: grid; gap: 7px; }
-.t-find input[type="text"] {
- width: 100%; font: inherit; font-size: 12px; padding: 5px 7px;
- border: 1px solid var(--line); border-radius: 6px;
- background: var(--field); color: var(--ink);
-}
-.t-find input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
+.t-find input[type="text"] { width: 100%; }
.t-find-opts { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); }
.t-find-opts label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.t-find-bar { display: flex; align-items: center; gap: 5px; }
@@ -583,11 +617,7 @@ html, body {
.t-xref-pick { width: min(440px, 100%); }
.t-xref-pick h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.t-xref-style { margin-bottom: 10px; }
-.t-xref-style select {
- width: 100%; font: inherit; font-size: 12.5px; padding: 5px 6px;
- background: var(--field); color: var(--ink);
- border: 1px solid var(--line); border-radius: 6px;
-}
+.t-xref-style select { width: 100%; }
.t-xref-list { display: flex; flex-direction: column; gap: 3px; }
.t-xref-list button {
display: flex; gap: 8px; align-items: baseline; text-align: start;
@@ -678,13 +708,7 @@ html, body {
padding: 6px; max-width: min(440px, calc(100vw - 16px));
box-shadow: 0 12px 32px rgb(20 30 45 / .22), 0 2px 8px rgb(20 30 45 / .12);
}
-.t-link-url {
- font: inherit; font-size: 13px;
- color: var(--ink); background: var(--field);
- border: 1px solid var(--line); border-radius: 8px;
- padding: 6px 8px; width: 240px; min-width: 0;
-}
-.t-link-url:focus { border-color: var(--blue); outline: none; }
+.t-link-url { width: 240px; min-width: 0; }
.t-link-pop .t-btn { padding: 6px 8px; }
.t-link-ok { color: var(--ink); font-weight: 600; }
.t-link-rm { color: var(--bad); }
@@ -763,12 +787,7 @@ html, body {
display: flex; align-items: center; gap: 7px;
color: var(--ink-2); font-size: 12px; margin-bottom: 5px; cursor: pointer;
}
-.t-input {
- font: inherit; font-size: 12px; color: var(--ink);
- background: var(--field); border: 1px solid var(--line);
- border-radius: 7px; padding: 4px 6px; width: 68px; min-width: 0;
-}
-.t-input:focus { border-color: var(--blue); outline: none; }
+.t-input { width: 68px; min-width: 0; }
.t-dlg .t-input { width: 90px; }
/* ————— comments —————
The layer is a SIBLING of .t-deco, not a child: drawPages() calls
@@ -812,11 +831,7 @@ html, body {
/* the reply box, shared by the margin card and the panel item */
.acts { margin-top: 6px; }
-.acts textarea {
- width: 100%; resize: vertical; font: inherit; font-size: 11.5px;
- color: var(--ink); background: var(--field);
- border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px;
-}
+.acts textarea { width: 100%; }
.acts .btns { display: flex; gap: 5px; margin-top: 5px; }
.acts .btns button {
flex: 1; font: inherit; font-size: 11px; padding: 3px 6px; cursor: pointer;
@@ -864,11 +879,7 @@ html, body {
/* ————— the Sources panel ————— */
.t-cite-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
-.t-cite-style {
- flex: 1 1 100%; font: inherit; font-size: 12px; padding: 4px 6px;
- color: var(--ink); background: var(--field);
- border: 1px solid var(--line); border-radius: 6px;
-}
+.t-cite-style { flex: 1 1 100%; }
.t-cite-btn, .t-cite-mini {
font: inherit; font-size: 11.5px; padding: 4px 8px; cursor: pointer;
color: var(--ink-2); background: var(--chrome);
@@ -892,12 +903,8 @@ html, body {
.t-cite-ref .r { word-break: break-word; }
/* ————— the import and picker dialogs ————— */
-.t-cite-paste, .t-cite-search {
- width: 100%; font: inherit; font-size: 12.5px; padding: 6px 8px; margin-top: 8px;
- color: var(--ink); background: var(--field);
- border: 1px solid var(--line); border-radius: 8px;
-}
-.t-cite-paste { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
+.t-cite-paste, .t-cite-search { width: 100%; margin-top: 8px; }
+.t-cite-paste { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.t-cite-pick { max-height: 46vh; overflow: auto; margin-top: 8px; }
.t-cite-row {
display: flex; gap: 8px; align-items: flex-start; padding: 6px 7px;
@@ -1021,13 +1028,7 @@ html, body {
.t-math-bad { text-decoration: underline dotted var(--bad); text-underline-offset: 4px; }
/* ————— the Math panel ————— */
-.t-mathsrc {
- width: 100%; box-sizing: border-box; resize: vertical;
- font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
- color: var(--ink); background: var(--field);
- border: 1px solid var(--line); border-radius: 6px; padding: 6px 7px;
-}
-.t-mathsrc:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
+.t-mathsrc { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.t-mathprev {
display: flex; align-items: center; justify-content: center;
min-height: 52px; margin: 8px 0; padding: 10px 8px; overflow-x: auto;