Debounce vs Throttle
Choose between debounce and throttle for high-frequency user input events.
Pattern level: micro
Choose between debounce and throttle for high-frequency user input events.
Pattern level: micro
Use debounce for final-intent actions like search requests, and throttle for continuous feedback like scroll and resize.
Both techniques bound invocation rate; they differ in whether intermediate events are intentionally dropped.
Pick based on user intent timing, side-effect cost, and tolerance for delayed updates.
| Category | Level | Requirement | Done When |
|---|---|---|---|
| functional | unit | Debounce/cancel behavior avoids stale result rendering. | Typing burst tests prove stale response protection. |
| a11y | integration | Combobox roles, active descendant, and keyboard bindings are correct. | ARIA combobox checks pass in automated and manual tests. |
| a11y | e2e | Result count and active option are announced clearly. | Screen reader walkthrough validates interaction end-to-end. |
title: "Debounce vs Throttle" summary: "Choose the right input pacing strategy for search, resize, and scroll interactions." kind: "pattern" level: "micro" tags: ["performance", "testing", "a11y"] usedIn:
Debounce delays execution until input settles, throttle guarantees a maximum update cadence.
Symptom: Requests intermittently fail.
Mitigation: Retry with backoff and restore from last known good snapshot.
| Category | Level | Requirement | Done When |
|---|---|---|---|
| functional | unit | Debounce/cancel behavior avoids stale result rendering. | Typing burst tests prove stale response protection. |
| a11y | integration | Combobox roles, active descendant, and keyboard bindings are correct. | ARIA combobox checks pass in automated and manual tests. |
| a11y | e2e | Result count and active option are announced clearly. | Screen reader walkthrough validates interaction end-to-end. |