Keep your coding agent up to date with the latest web best practices
Release v0.0.92
github-actions[bot]0c5e052765e8
diff --git a/README.md b/README.mdindex 38ba087..f339997 100644--- a/README.md+++ b/README.md@@ -5,7 +5,7 @@ This curated collection of skills, tools, and AI-ready documentation injects Chr#### Skill Coverage in `v0.0.92`<details>-<summary><strong>82 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `<details>`, `<dialog closedby>`, `<dialog>`, `<link rel="expect">`, `<link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor position container queries`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `Container queries`, `Container scroll-state queries`, `content-visibility`, `Cross-document view transitions`, `Customizable <select>`, `Email, telephone, and URL <input> types`, `enterkeyhint`, `Event timing`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intersection observer`, `Intl.DurationFormat`, `Invoker commands`, `Language detector`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive <details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Summarizer`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `Translator`, `View transitions`, `view-transition-class`</summary>+<summary><strong>83 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `<details>`, `<dialog closedby>`, `<dialog>`, `<link rel="expect">`, `<link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor position container queries`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `Container queries`, `Container scroll-state queries`, `content-visibility`, `Cross-document view transitions`, `Customizable <select>`, `Email, telephone, and URL <input> types`, `enterkeyhint`, `Event timing`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intersection observer`, `Intl.DurationFormat`, `Invoker commands`, `Language detector`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive <details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollend`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Summarizer`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `Translator`, `View transitions`, `view-transition-class`</summary>- **[::backdrop](https://webstatus.dev/features/backdrop), [<dialog>](https://webstatus.dev/features/dialog), [overlay](https://webstatus.dev/features/overlay), [Popover](https://webstatus.dev/features/popover), [@starting-style](https://webstatus.dev/features/starting-style), [transition-behavior](https://webstatus.dev/features/transition-behavior)**- **animate-to-from-top-layer**: Animate elements such as dialogs, popovers, and tooltips as they're entering/exiting the top layer.@@ -151,6 +151,8 @@ This curated collection of skills, tools, and AI-ready documentation injects Chr- **scroll-target-on-load**: Build a scrollable list of elements (e.g. a carousel of images or a chat conversation thread) that can be displayed with a particular element scrolled into view on the initial render.- **[scrollbar-color](https://webstatus.dev/features/scrollbar-color), [scrollbar-width](https://webstatus.dev/features/scrollbar-width)**- **customize-scrollbar-color-and-thickness**: Customize the color or thickness of a scrollbar+- **[scrollend](https://webstatus.dev/features/scrollend)**+ - **defer-work-until-scroll-ends**: Defer expensive operations like DOM updates, data fetching, analytics tracking, or layout recalculation until after scrolling completes to maintain smooth scroll performance.- **[sibling-count() and sibling-index()](https://webstatus.dev/features/sibling-count)**- **dynamic-sibling-animations**: Stagger animation or transition timing across sibling elements so each one starts after a computed delay based on its position in the sibling list.- **[sibling-count() and sibling-index()](https://webstatus.dev/features/sibling-count), [sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)](https://webstatus.dev/features/trig-functions)**diff --git a/skills/modern-web/guides/performance/defer-work-until-scroll-ends.md b/skills/modern-web/guides/performance/defer-work-until-scroll-ends.mdnew file mode 100644index 0000000..7a36789--- /dev/null+++ b/skills/modern-web/guides/performance/defer-work-until-scroll-ends.md@@ -0,0 +1,77 @@+# Defer Work Until Scroll Ends++Scrolling on the web should be smooth and responsive. Executing heavy tasks—such as layout recalculations, analytics data beacons tracking, or dynamic DOM updates—during scrolling can saturate the main thread, resulting in dropped frames and layout thrashing.++Historically, developers have relied on debouncing the `scroll` event using `setTimeout()` to guess when a scroll is finished. However, these debounced functions are notoriously unreliable. They may trigger while the user’s is still scrolling.++The `scrollend` event offers a highly reliable, performance-driven solution. The browser fires a `scrollend` event exactly when a scroll has rested, all transitions are finished, and a touch gesture has been released.++## How to Implement++To implement a defer-work pattern:++1. **Set Up a Scrollable Container**: Create a container with `overflow: auto` or `overflow: scroll`.+2. **Listen for `scroll` events**: Only use this listener for basic dynamic metrics or informative layout styling. Do not execute heavy work here.+3. **Listen for `scrollend` events**: Register a `scrollend` callback on the scroll container or the document itself.+4. **Execute Expensive work in the callback**: This is where it's safe to fetch dynamic content or trigger comprehensive DOM layouts.++## Example Code++```css+.scroll-container {+ height: 300px;+ overflow-y: auto;+}+```++```javascript+const scroller = document.querySelector('.scroll-container');++// 1. Informative feedback during scroll+scroller.addEventListener('scroll', () => {+ // Avoid dynamic heavier data updates here+ console.log('Scrolling dynamically... updates deferred');+});++// 2. Safe callback when scrolling rests+scroller.addEventListener('scrollend', () => {+ // Run layout recalculations or analytical beacons updates here+ const currentVisibleSection = findMostVisibleSection(scroller);+ fetchAdditionalData(currentVisibleSection);+});+```++## Strategic Implementation & Best Practices++- **DO** use `scrollend` instead of debounced `scroll` events when firing layout data beacons or fetching new content content layout dynamically.+- **DO** consider pairing this with `scrollSnapChange` or `scrollSnapChanging` snap interactions if you're building carousels or testimonial galleries slides.+- **DO NOT** bundle layout-dependent dynamic updates inside dynamic visual scroll callbacks.+- **DO** consider that visual viewport zooming and scrolling triggers the `scrollend` event correctly.++## Fallback Strategy++Baseline status for scrollend: Newly available. It's been Baseline since 2025-12-12.++For unsupported browsers, fall back to a debounced `scroll` event with `setTimeout` to dispatch a custom `scrollend` event.++```javascript+function initializeDemo() {+ const scroller = document.querySelector('#scroller');+ scroller.addEventListener('scrollend', () => {+ // Safe execution+ });+}++if ('onscrollend' in window) {+ initializeDemo();+} else {+ initializeDemo();+ const scroller = document.querySelector('#scroller');+ scroller.addEventListener('scroll', () => {+ clearTimeout(window.scrollendtimer);+ window.scrollendtimer = setTimeout(() => {+ scroller.dispatchEvent(new CustomEvent('scrollend'));+ }, 100);+ });+}+```