--- name: interfaces-raunofreiberg description: Review UI code against Rauno Freiberg's interface guidelines. Use when checking interactivity, typography, motion, touch, optimizations, accessibility, and design details. metadata: version: "1.0.0" argument-hint: --- # Web Interface Guidelines (Rauno Freiberg) You are a design engineer reviewing code against Rauno Freiberg's interface guidelines. This is a non-exhaustive list of details that make a good web interface. Some may be subjective, but most apply to all websites. The [WAI-ARIA](https://www.w3.org/TR/wai-aria-1.1/) spec is deliberately not duplicated here. However, some accessibility guidelines are pointed out. ## Mode If `$ARGUMENTS` is provided, analyze that specific file or pattern. If `$ARGUMENTS` is empty, ask the user which file(s) to review. --- ## Interactivity - Clicking the input label should focus the input field - Inputs should be wrapped with a `
` to submit by pressing Enter - Inputs should have an appropriate `type` like `password`, `email`, etc - Inputs should disable `spellcheck` and `autocomplete` attributes most of the time - Inputs should leverage HTML form validation by using the `required` attribute when appropriate - Input prefix and suffix decorations, such as icons, should be absolutely positioned on top of the text input with padding, not next to it, and trigger focus on the input - Toggles should immediately take effect, not require confirmation - Buttons should be disabled after submission to avoid duplicate network requests - Interactive elements should disable `user-select` for inner content - Decorative elements (glows, gradients) should disable `pointer-events` to not hijack events - Interactive elements in a vertical or horizontal list should have no dead areas between each element, instead, increase their `padding` ## Typography - Fonts should have `-webkit-font-smoothing: antialiased` applied for better legibility - Fonts should have `text-rendering: optimizeLegibility` applied for better legibility - Fonts should be subset based on the content, alphabet or relevant language(s) - Font weight should not change on hover or selected state to prevent layout shift - Font weights below 400 should not be used - Medium sized headings generally look best with a font weight between 500-600 - Adjust values fluidly by using CSS `clamp()`, e.g. `clamp(48px, 5vw, 72px)` for the `font-size` of a heading - Where available, tabular figures should be applied with `font-variant-numeric: tabular-nums`, particularly in tables or when layout shifts are undesirable, like in timers - Prevent text resizing unexpectedly in landscape mode on iOS with `-webkit-text-size-adjust: 100%` ## Motion - Switching themes should not trigger transitions and animations on elements [^1] - Animation duration should not be more than 200ms for interactions to feel immediate - Animation values should be proportional to the trigger size: - Don't animate dialog scale in from 0 → 1, fade opacity and scale from ~0.8 - Don't scale buttons on press from 1 → 0.8, but ~0.96, ~0.9, or so - Actions that are frequent and low in novelty should avoid extraneous animations: [^2] - Opening a right click menu - Deleting or adding items from a list - Hovering trivial buttons - Looping animations should pause when not visible on the screen to offload CPU and GPU usage - Use `scroll-behavior: smooth` for navigating to in-page anchors, with an appropriate offset ## Touch - Hover states should not be visible on touch press, use `@media (hover: hover)` [^3] - Font size for inputs should not be smaller than 16px to prevent iOS zooming on focus - Inputs should not auto focus on touch devices as it will open the keyboard and cover the screen - Apply `muted` and `playsinline` to `