Skip to content

Search Feitio

↵ opens the first↑↓ chooseEsc closes

Just enough JavaScript

Where Feitio uses scripts, what the browser already does on its own, and the rules for not overdoing it.

On this page

The principle

Feitio uses JavaScript where it makes the screen better, and does not have to work without it. What stays out is excess: a big library for a small effect, a script on every page out of habit, the whole screen built in the browser when the server would deliver it ready.

Before writing a script, check whether the browser already does it. What it does on its own arrives accessible: keyboard, screen reader and focus.

ComponentThe browser doesThe script adds
Drawerthe browser’s popover: opens, closes with Esc and a tap outsidenone
Dialogthe browser’s <dialog>, with showModal()one line to open
Detailsthe browser’s <details>the open and close animation
AppShell—the header that hides on scroll, on mobile
ScrollFade, BackToTop—show when they apply; smooth scroll to the top
StatusOverlay—the loading, done and error states
CodeBlock—copy and code colors

Rules

Top