Abstand zur Beschriftung folgt aus der Polsterung des Feldes

„Zwischen der Auswahl und dem Text ist kaum Platz" - und das stimmte überall,
nicht nur an der einen Stelle. Der Grund war messbar: der Abstand zur
Beschriftung betrug 8 px, die Polsterung innerhalb des Feldes 11,2 px. Das Wort
stand also näher am Rahmen als der Inhalt des Rahmens an demselben Rahmen, und
genau daran erkennt das Auge einen zu engen Satz.

Die Regel heisst jetzt: der Abstand nach aussen ist grösser als die Polsterung
nach innen. Sie steht einmal in globals.css als .field-label, .field-row und
.field-hint - vorher war sie ein Dutzend Mal als mt-1, mt-1.5 oder gap-2 an den
Aufrufstellen verteilt, mit drei verschiedenen Werten, von denen keiner
reichte. 33 Stellen umgestellt.

Der Test prüft die Regel und nicht die Zahl: er liest die Polsterung von .field
aus dem CSS und verlangt, dass beide Abstände darüber liegen. Gegengeprobt mit
einem zu kleinen Wert, dann schlägt er an.

Nachgemessen im Browser mit dem gebauten CSS: 8 px senkrecht gegen 5,6 px
Innenpolsterung, 13,6 px waagerecht gegen 11,2 px.
This commit is contained in:
Harlekin
2026-09-03 20:28:42 +02:00
parent aef3df0d44
commit d49edeed18
11 changed files with 120 additions and 50 deletions
@@ -95,19 +95,19 @@ export function DepartmentEntries({
{canWrite ? (
<div className="mb-8 border border-line p-4">
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{departmentEntryText.body}
</span>
<textarea
value={text}
onChange={(event) => setText(event.target.value)}
rows={3}
className="field mt-1.5 w-full"
className="field w-full"
/>
</label>
<div className="mt-3 flex flex-wrap items-center gap-4">
<label className="flex items-center gap-2 text-2xs text-text-dim">
<label className="field-row text-2xs text-text-dim">
{departmentEntryText.minClearance}
<select
value={stufe}
@@ -255,13 +255,13 @@ function Vermerk({
{modus === 'zurueckziehen' ? (
<div className="mt-2">
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{departmentEntryText.retractReason}
</span>
<input
value={grund}
onChange={(event) => setGrund(event.target.value)}
className="field mt-1.5 w-full max-w-sm"
className="field w-full max-w-sm"
/>
</label>
<div className="mt-2 flex flex-wrap items-center gap-3">
@@ -67,15 +67,15 @@ export function DepartmentForm({
<div className="grid gap-4 sm:grid-cols-2">
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{departmentAdminText.key}
</span>
{existing ? (
<p className="mt-1.5 font-mono text-sm">{existing.key}</p>
) : (
<>
<input name="key" required maxLength={21} className="field mt-1.5 w-full font-mono" />
<span className="mt-1 block text-2xs text-text-dim">
<input name="key" required maxLength={21} className="field w-full font-mono" />
<span className="field-hint">
{departmentAdminText.keyHint}
</span>
</>
@@ -83,7 +83,7 @@ export function DepartmentForm({
</label>
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{departmentAdminText.name}
</span>
<input
@@ -91,13 +91,13 @@ export function DepartmentForm({
required
maxLength={120}
defaultValue={existing?.name}
className="field mt-1.5 w-full"
className="field w-full"
/>
</label>
</div>
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{departmentAdminText.description}
</span>
<textarea
@@ -105,19 +105,19 @@ export function DepartmentForm({
rows={2}
maxLength={500}
defaultValue={existing?.description ?? ''}
className="field mt-1.5 w-full"
className="field w-full"
/>
</label>
<div className="flex flex-wrap items-end gap-6">
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{departmentAdminText.minClearance}
</span>
<select
name="minClearance"
defaultValue={existing?.minClearance ?? 0}
className="field mt-1.5"
className="field"
>
{levels.map((level) => (
<option key={level.level} value={level.level}>
@@ -125,7 +125,7 @@ export function DepartmentForm({
</option>
))}
</select>
<span className="mt-1 block text-2xs text-text-dim">
<span className="field-hint">
{departmentAdminText.minClearanceHint}
</span>
</label>
+12 -12
View File
@@ -66,9 +66,9 @@ export default async function AuditLogPage({
<p className="mt-1 max-w-(--container-measure) text-2xs text-text-dim">{de.audit.intro}</p>
<form method="get" className="mt-6 flex flex-wrap items-end gap-3">
<label className="text-2xs text-text-dim">
{de.audit.filterActor}
<select name="wer" defaultValue={filter.actorId ?? ''} className="field mt-1 text-2xs">
<label className="block">
<span className="field-label">{de.audit.filterActor}</span>
<select name="wer" defaultValue={filter.actorId ?? ''} className="field text-2xs">
<option value="">{de.audit.all}</option>
{akteure.map((akteur) => (
<option key={akteur.id} value={akteur.id}>
@@ -78,9 +78,9 @@ export default async function AuditLogPage({
</select>
</label>
<label className="text-2xs text-text-dim">
{de.audit.filterAction}
<select name="was" defaultValue={filter.action ?? ''} className="field mt-1 text-2xs">
<label className="block">
<span className="field-label">{de.audit.filterAction}</span>
<select name="was" defaultValue={filter.action ?? ''} className="field text-2xs">
<option value="">{de.audit.all}</option>
{aktionen.map((aktion) => (
<option key={aktion} value={aktion}>
@@ -90,23 +90,23 @@ export default async function AuditLogPage({
</select>
</label>
<label className="text-2xs text-text-dim">
{de.audit.filterFrom}
<label className="block">
<span className="field-label">{de.audit.filterFrom}</span>
<input
type="date"
name="ab"
defaultValue={wert('ab') ?? ''}
className="field mt-1 font-mono text-2xs"
className="field font-mono text-2xs"
/>
</label>
<label className="text-2xs text-text-dim">
{de.audit.filterTo}
<label className="block">
<span className="field-label">{de.audit.filterTo}</span>
<input
type="date"
name="bis"
defaultValue={wert('bis') ?? ''}
className="field mt-1 font-mono text-2xs"
className="field font-mono text-2xs"
/>
</label>
+2 -2
View File
@@ -83,7 +83,7 @@ export function RoleRow({
</div>
<div className="mt-3 flex flex-wrap gap-x-8 gap-y-3 text-xs">
<label className="flex items-center gap-2">
<label className="field-row">
<span className="font-condensed text-text-dim">{roleAdminText.category}</span>
<select
value={category}
@@ -101,7 +101,7 @@ export function RoleRow({
</select>
</label>
<label className="flex items-center gap-2">
<label className="field-row">
<span className="font-condensed text-text-dim">{roleAdminText.clearance}</span>
<select
value={clearanceLevel}
@@ -51,7 +51,7 @@ export function EntryComposer({ caseNumber }: { caseNumber: string }) {
action={() => submit(draft)}
className="max-w-(--container-measure)"
>
<label htmlFor="vermerk" className="font-condensed text-xs text-text-dim">
<label htmlFor="vermerk" className="field-label">
{caseText.newEntry}
</label>
<textarea
+4 -4
View File
@@ -21,7 +21,7 @@ export function NewCaseForm({
return (
<form action={action} className="mt-6 space-y-5">
<div>
<label htmlFor="title" className="font-condensed text-xs text-text-dim">
<label htmlFor="title" className="field-label">
{caseText.title}
</label>
<input
@@ -35,7 +35,7 @@ export function NewCaseForm({
</div>
<div>
<label htmlFor="templateKey" className="font-condensed text-xs text-text-dim">
<label htmlFor="templateKey" className="field-label">
{caseText.type}
</label>
<select
@@ -53,7 +53,7 @@ export function NewCaseForm({
</div>
<div>
<label htmlFor="classification" className="font-condensed text-xs text-text-dim">
<label htmlFor="classification" className="field-label">
{clearanceText.classification}
</label>
{/* Die Auswahl zeigt nur, was erlaubt ist. Geprüft wird trotzdem serverseitig. */}
@@ -73,7 +73,7 @@ export function NewCaseForm({
{people.length > 0 ? (
<div>
<label htmlFor="personnelFileId" className="font-condensed text-xs text-text-dim">
<label htmlFor="personnelFileId" className="field-label">
{caseText.subject}
</label>
{/* Gleich beim Anlegen verknüpfen erspart den zweiten Schritt, den
@@ -107,13 +107,13 @@ export function PersonnelHead({
<div className="grid gap-4 sm:grid-cols-2">
<Feld id="rank" label={personnelText.rank} defaultValue={file.rank} />
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{personnelText.department}
</span>
<select
name="departmentId"
defaultValue={file.departmentId ?? ''}
className="field mt-1.5 w-full"
className="field w-full"
>
<option value="">{personnelText.noDepartment}</option>
{departments.map((abteilung) => (
@@ -140,10 +140,10 @@ export function PersonnelHead({
</label>
))}
</div>
<p className="mt-1 text-2xs text-text-dim">{personnelText.statusHint}</p>
<p className="field-hint">{personnelText.statusHint}</p>
</fieldset>
<div>
<label htmlFor="note" className="font-condensed text-2xs text-text-dim">
<label htmlFor="note" className="field-label">
{personnelText.note}
</label>
<textarea
@@ -294,7 +294,7 @@ function Feld({
}) {
return (
<div>
<label htmlFor={id} className="font-condensed text-2xs text-text-dim">
<label htmlFor={id} className="field-label">
{label}
</label>
<input
@@ -35,7 +35,7 @@ export function NewPersonnelForm({
<Feld id="displayName" label={personnelText.name} required minLength={2} />
<div>
<label htmlFor="userId" className="font-condensed text-xs text-text-dim">
<label htmlFor="userId" className="field-label">
{personnelText.linkedAccount}
</label>
<select
@@ -56,10 +56,10 @@ export function NewPersonnelForm({
<div className="grid gap-5 sm:grid-cols-2">
<Feld id="rank" label={personnelText.rank} />
<label className="block">
<span className="font-condensed text-2xs text-text-dim">
<span className="field-label">
{personnelText.department}
</span>
<select name="departmentId" defaultValue="" className="field mt-1.5 w-full">
<select name="departmentId" defaultValue="" className="field w-full">
<option value="">{personnelText.noDepartment}</option>
{departments.map((abteilung) => (
<option key={abteilung.id} value={abteilung.id}>
@@ -82,11 +82,11 @@ export function NewPersonnelForm({
</label>
))}
</div>
<p className="mt-1 text-2xs text-text-dim">{personnelText.statusHint}</p>
<p className="field-hint">{personnelText.statusHint}</p>
</fieldset>
<div>
<label htmlFor="note" className="font-condensed text-xs text-text-dim">
<label htmlFor="note" className="field-label">
{personnelText.note}
</label>
<textarea
@@ -95,11 +95,11 @@ export function NewPersonnelForm({
rows={3}
className="mt-1.5 block w-full field"
/>
<p className="mt-1 text-2xs text-text-dim">{personnelText.noteHelp}</p>
<p className="field-hint">{personnelText.noteHelp}</p>
</div>
<div>
<label htmlFor="classification" className="font-condensed text-xs text-text-dim">
<label htmlFor="classification" className="field-label">
{clearanceText.classification}
</label>
{/* Die Auswahl zeigt nur, was erlaubt ist. Geprüft wird trotzdem serverseitig. */}
@@ -145,7 +145,7 @@ function Feld({
}) {
return (
<div>
<label htmlFor={id} className="font-condensed text-xs text-text-dim">
<label htmlFor={id} className="field-label">
{label}
</label>
<input