Progressive enhancement starts with functionality that works across a broad range of browsers and devices, then adds capabilities where they are supported. Browser versions, available APIs, and user permissions vary; a feature should not make the rest of an application unusable when it is absent. section 2.2 section 2.1.3
Make each enhancement an optional layer:
- Establish the baseline behavior first, then detect the specific API before using it. Check compatibility data with MDN, Can I Use, or Baseline when deciding whether a fallback is needed. section 2.2.1
- Keep ordinary navigation available. Real links can work without JavaScript; client-side routing may add soft transitions, focus restoration, and dynamic titles. section 15.12
- Handle unavailable or denied permissions as well as unsupported APIs. Request access when it is needed, explain why, and retain a reduced but working mode if access is denied. section 2.1.3
An optional route animation
A route change needs to replace the current view; animation is not required for routing. If document.startViewTransition is available, wrap that replacement in a transition. Otherwise, perform the same replacement directly. Animation CSS can also respect prefers-reduced-motion. section 11.3.1
Listing 11.1 Wrapping a route update in a same-document view transition
if ("startViewTransition" in document) {
document.startViewTransition(() => {
outlet.replaceChildren(nextView);
});
} else {
outlet.replaceChildren(nextView);
}
The two branches perform the same route update, with a transition only when the API exists. section 11.3.1
The same decision applies beyond animation. A 3D view can select an available model display option while retaining a fallback; a router can use the Navigation API with a History API fallback. The rule is to preserve the feature’s job while allowing supported devices to do more. section 3.6.3 section 11.4


