Skip to content

Keep your coding agent up to date with the latest web best practices

Release v0.0.84

github-actions[bot]3521f4453597
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 737deb5..854bff8 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -8,7 +8,7 @@
"name": "modern-web-guidance",
"source": "./",
"description": "Google Chrome's agent skills collection",
- "version": "0.0.83"
+ "version": "0.0.84"
}
]
}
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 83dc8c8..9ce0118 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Google Chrome's agent skills collection",
- "version": "0.0.83",
+ "version": "0.0.84",
"author": {
"name": "Google Chrome"
}
diff --git a/README.md b/README.md
index ef8a50f..fc5873e 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
This curated collection of skills, tools, and AI-ready documentation injects Chrome's web platform knowledge directly into your workflow, ensuring your coding agent builds apps that are modern, fast, and secure by default.
-#### Skill Coverage in `v0.0.83`
+#### Skill Coverage in `v0.0.84`
<details>
<summary><strong>79 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `&lt;details>`, `&lt;dialog closedby>`, `&lt;dialog>`, `&lt;link rel="expect">`, `&lt;link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `Container queries`, `content-visibility`, `Cross-document view transitions`, `Customizable &lt;select>`, `Email, telephone, and URL &lt;input> types`, `enterkeyhint`, `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 &lt;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>
@@ -64,6 +64,10 @@ This curated collection of skills, tools, and AI-ready documentation injects Chr
- **size-aware-styling**: Build a component whose styles can be conditionally dependent on its own width or height, rather than the width or height of the viewport. For example a card component that can change its layouts depending on how large it is, or a call-to-action button that can conditionally display helper text based on its width.
- **[content-visibility](https://webstatus.dev/features/content-visibility), [hidden="until-found"](https://webstatus.dev/features/hidden-until-found)**
- **defer-rendering-heavy-content**: Reduce rendering times in content-heavy web pages (e.g. pages with long feeds, lots of articles, or complex dashboards), by deferring rendering for any content that is not immediately visible to the user.
+- **[content-visibility](https://webstatus.dev/features/content-visibility)**
+ - **efficient-background-processing**: Conserve system resources and battery life by pausing background JavaScript execution (such as `<canvas>` animations, WebGL rendering, or high-frequency WebSocket data polling) when the component is off-screen and then resume them just-in-time when they scroll back into view.
+ - **faster-spa-view-transitions**: Enable faster transitions back to previously visited views in a Single-Page Application (SPA) by preserving their structural DOM state instead of destroying and rebuilding them on every navigation.
+ - **interactions-in-complex-layouts**: Make interactions snappier and more responsive (reducing Interaction to Next Paint (INP) scores) by avoiding layout re-calculations in complex layouts, such as data-heavy dashboards or spreadsheet-style grids.
- **[Cross-document view transitions](https://webstatus.dev/features/cross-document-view-transitions), [Navigation API](https://webstatus.dev/features/navigation), [View transitions](https://webstatus.dev/features/view-transitions)**
- **cross-document-transitions**: Create smooth, seamless transitions between full page navigations, such as cross-fades, custom reveal effects, or morphing of content from one page to the next.
- **[Customizable &lt;select>](https://webstatus.dev/features/customizable-select)**
diff --git a/gemini-extension.json b/gemini-extension.json
index fcfa0ed..a3aed9d 100644
--- a/gemini-extension.json
+++ b/gemini-extension.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Google Chrome's web development agent skills.",
- "version": "0.0.83",
+ "version": "0.0.84",
"author": {
"name": "Google Chrome"
}
diff --git a/package.json b/package.json
index 13625cf..0cb1555 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "modern-web-guidance",
"displayName": "Modern Web Guidance",
"description": "Curated collection of agent skills for modern web development.",
- "version": "0.0.83",
+ "version": "0.0.84",
"publisher": "GoogleChrome",
"engines": {
"vscode": "^1.90.0",
diff --git a/skills/modern-web/guides/performance/efficient-background-processing.md b/skills/modern-web/guides/performance/efficient-background-processing.md
new file mode 100644
index 0000000..e23951b
--- /dev/null
+++ b/skills/modern-web/guides/performance/efficient-background-processing.md
@@ -0,0 +1,116 @@
+# Efficient Background Processing
+
+Pause heavy background tasks when a component is not being rendered by the browser to conserve system resources and battery life.
+
+## Overview
+
+The `content-visibility: auto` property allows the browser to skip rendering calculations for elements that are far outside the viewport. When the browser decides to skip or resume rendering for an element, it fires the `contentvisibilityautostatechange` event on that element.
+
+By listening to this event, you can pause expensive operations like `<canvas>` animations, WebGL rendering, or high-frequency WebSocket data polling when they are not needed, and resume them just-in-time when the browser prepares to display the content.
+
+### `contentvisibilityautostatechange` vs. `IntersectionObserver`
+
+It is important to understand when to use which API:
+
+* **Use `IntersectionObserver` for application logic** tied to the exact visual visibility of an element in the viewport (e.g., lazy-loading data, infinite scroll triggers).
+* **Use `contentvisibilityautostatechange` for rendering-heavy work** (like complex canvas updates or heavy DOM mutations). This event ties directly to the browser's internal rendering lifecycle. The browser often starts rendering an element before it actually appears on screen (the pre-render margin). This event tells you when that happens, ensuring your content is ready to be seen.
+
+## Implementation
+
+### 1. Apply CSS Content Visibility
+
+Set `content-visibility: auto` on the heavy container and provide a placeholder size to prevent scrollbar jumping.
+
+```css
+.heavy-component {
+ /* Defer rendering work when off-screen */
+ content-visibility: auto;
+
+ /* Mandatory: Provide a placeholder size to prevent layouts shifts.
+ - 'auto' is optional and enables the browser to remember the actual size
+ once rendered. It must be paired with a <length> value to be used for
+ the first render.
+ - 'none' tells the browser not to apply any intrinsic width to this element.
+ It can be used for either the height or the width value.
+ - '500px' is the estimated height of this element. This can be any valid
+ CSS <length> value. Replace it with the expected height of your
+ component.
+ */
+ contain-intrinsic-size: auto none auto 500px;
+}
+```
+
+### 2. Listen for State Changes
+
+Add an event listener for `contentvisibilityautostatechange` to pause or resume background tasks.
+
+> **Important:** The `contentvisibilityautostatechange` event does not bubble in some browser implementations. To handle this event reliably, you must either:
+> - Attach the event listener directly to the element that has `content-visibility: auto` applied.
+> - Use a capturing event listener (`{ capture: true }`) if you are delegating events to a parent container.
+
+```javascript
+const component = document.querySelector('.heavy-component');
+
+// Option 1: Direct listener (recommended)
+component.addEventListener('contentvisibilityautostatechange', (event) => {
+ if (event.skipped) {
+ // The browser skipped rendering this content.
+ // DO NOT perform heavy mutations or animation loops here.
+ stopSimulation();
+ pauseWebSocketPolling();
+ } else {
+ // The browser is about to render the content.
+ // Resume your work so it is ready when visible.
+ startSimulation();
+ resumeWebSocketPolling();
+ }
+});
+
+// Option 2: Capturing listener for event delegation
+document.addEventListener('contentvisibilityautostatechange', (event) => {
+ if (event.target.matches('.heavy-component')) {
+ if (event.skipped) {
+ stopSimulation();
+ } else {
+ startSimulation();
+ }
+ }
+}, { capture: true });
+```
+
+### Fallback strategies
+
+Baseline status for content-visibility: Newly available. It's been Baseline since 2025-09-15.
+
+The `content-visibility` property and the associated `contentvisibilityautostatechange` event are progressive enhancements. In browsers that do not support them:
+* The CSS property is ignored, and the content is rendered normally.
+* The event never fires, so background tasks will continue to run as they normally would without optimization.
+
+If you must support pausing tasks on older browsers, you can fallback to using `IntersectionObserver` as a rough approximation. This helps save battery and CPU on older devices too.
+
+```javascript
+// Fallback using IntersectionObserver for older browsers
+const target = document.getElementById('target-container');
+
+// Check if content-visibility is supported
+const isSupported = 'contentVisibility' in document.documentElement.style;
+
+if (!isSupported) {
+ const observer = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ // The element is close to the screen. Start work!
+ startSimulation();
+ } else {
+ // The element is far away. Pause work!
+ stopSimulation();
+ }
+ });
+ }, {
+ // Use rootMargin to start rendering before it hits the screen
+ rootMargin: '200px'
+ });
+
+ observer.observe(target);
+}
+```
diff --git a/skills/modern-web/guides/performance/faster-spa-view-transitions.md b/skills/modern-web/guides/performance/faster-spa-view-transitions.md
new file mode 100644
index 0000000..51d650d
--- /dev/null
+++ b/skills/modern-web/guides/performance/faster-spa-view-transitions.md
@@ -0,0 +1,78 @@
+# Faster SPA View Transitions via State Caching
+
+Enable instant navigation between views in a Single-Page Application (SPA) by caching the rendered state of inactive views instead of destroying them.
+
+## Overview
+
+Traditionally, when a user navigates between tabs or views in an SPA, developers either destroy the old view or hide it using `display: none`. Both approaches require the browser to recreate or recalculate the full layout and paint when the user returns to that view.
+
+By using `content-visibility: hidden` on inactive views, the browser removes the element’s contents from the layout flow and stops painting it, but *retains* its cached rendering state in memory. When the user switches back, the view restores nearly instantly.
+
+### The CPU vs. RAM Trade-off
+
+While this approach offers massive performance benefits, it introduces a specific trade-off that you must manage carefully:
+
+* **CPU Savings:** Massive. The browser completely skips layout and paint passes for hidden views.
+* **RAM Cost:** High. The browser keeps all DOM nodes, event listeners, and state for the hidden view in memory.
+
+#### When This Trade-off Becomes Dangerous
+
+* **DO** use this strategy for simple applications with a small, predictable number of views (e.g., a 3-to-5 tabbed interface).
+* **DO NOT** unconditionally cache every view in highly dynamic applications that generate dozens of unique reports or use infinite dynamic routes. Doing so will eventually cause severe memory bloat and may crash the browser on low-end devices.
+* **MANDATORY:** If your application is highly dynamic, you MUST implement an **eviction strategy** (like a Least Recently Used cache) to destroy old views when a memory threshold is reached.
+
+## Implementation
+
+### 1. Configure View Containers
+
+Set `content-visibility: hidden` on views that are not currently active.
+
+> **Note:** The `content-visibility: hidden` property hides an element's *contents*, but the element itself remains styled and visible. Its background, borders, padding, and margins will still be painted by the browser.
+
+```css
+.spa-view.inactive {
+ /* MANDATORY: Use hidden to cache the rendering state of inactive views */
+ content-visibility: hidden;
+
+ /* Optional: Prevent hidden views from taking up physical space in layout flow */
+ position: absolute;
+}
+```
+
+### 2. Manage Focus
+
+When swapping views, ensure you manage keyboard focus correctly to preserve accessibility.
+
+```javascript
+function switchToView(viewId) {
+ // Hide all views
+ document.querySelectorAll('.spa-view').forEach(view => {
+ view.classList.add('inactive');
+ view.setAttribute('aria-hidden', 'true');
+ });
+
+ // Show the target view
+ const activeView = document.getElementById(viewId);
+ activeView.classList.remove('inactive');
+ activeView.setAttribute('aria-hidden', 'false');
+
+ // MANDATORY: Move focus to the new view to ensure a logical tab-order
+ activeView.focus();
+}
+```
+
+### Fallback strategies
+
+Baseline status for content-visibility: Newly available. It's been Baseline since 2025-09-15.
+
+The `content-visibility` property degrades gracefully. In browsers that do not support it:
+* The property is ignored.
+* To prevent fallback browsers from rendering all views simultaneously, you should provide a fallback to `display: none` in your CSS:
+
+```css
+@supports not (content-visibility: hidden) {
+ .spa-view.inactive {
+ display: none;
+ }
+}
+```
diff --git a/skills/modern-web/guides/performance/interactions-in-complex-layouts.md b/skills/modern-web/guides/performance/interactions-in-complex-layouts.md
new file mode 100644
index 0000000..804fdc4
--- /dev/null
+++ b/skills/modern-web/guides/performance/interactions-in-complex-layouts.md
@@ -0,0 +1,77 @@
+# Optimizing Interactions in Complex Layouts
+
+Maintain high frame rates (60FPS) and eliminate interaction latency during drag-and-drop or heavy mutations in complex, multi-column layouts like Kanban boards or massive data grids.
+
+## Overview
+
+In complex layouts, performing a minor change to a single item—such as dragging a card or editing a cell—can trigger a chain reaction of style and layout calculations that forces the browser to reflow the entire page. This results in dropped frames and high Interaction to Next Paint (INP) latency.
+
+By applying `content-visibility: auto` to self-contained layout regions (like columns in a Kanban board), you can isolate rendering work.
+
+### Mechanism for On-Screen Elements
+
+It is important to understand how `content-visibility: auto` benefits elements that are **already visible on the screen**:
+
+* For visible elements, the browser **does not** skip rendering.
+* Instead, the performance benefit comes entirely from the **CSS containments** that the property automatically enforces (i.e., layout, style, and paint).
+* This containment acts as a boundary. If a mutation occurs inside a container with containment applied, the browser knows that the changes cannot affect the geometry or styles of elements outside that container. The page reflow is isolated, preventing a global layout recalculation.
+
+## Implementation
+
+### 1. Identify Containment Regions
+
+Apply `content-visibility: auto` to large, self-contained containers that represent isolated layout units (e.g., grid columns, board lists).
+
+```css
+.board-column {
+ /* Apply containment boundaries */
+ content-visibility: auto;
+
+ /* Mandatory: Provide a placeholder size to prevent layouts shifts.
+ For a vertical column, define a reasonable width and height.
+ - 'auto' is optional and enables the browser to remember the actual size
+ once rendered. It must be paired with a <length> value to be used for
+ the first render.
+ - '300px' is the estimated width of this element. This can be any valid
+ CSS <length> value. Replace it with the expected width of your
+ component.
+ - '800px' is the estimated height of this element. This can be any valid
+ CSS <length> value. Replace it with the expected height of your
+ component.
+ */
+ contain-intrinsic-size: auto 300px auto 800px;
+}
+```
+
+### 2. Manage Interactions
+
+Ensure that interactions occurring inside the column benefit from the containment.
+
+```javascript
+// Example: Drag and drop item movement
+function moveItemToColumn(itemId, columnId) {
+ const item = document.getElementById(itemId);
+ const column = document.getElementById(columnId);
+
+ // The browser will only reflow this specific column,
+ // not the entire board layout!
+ column.appendChild(item);
+}
+```
+
+### Fallback strategies
+
+Baseline status for content-visibility: Newly available. It's been Baseline since 2025-09-15.
+
+The property degrades gracefully. In unsupported browsers:
+* The property is ignored, and mutations will cause the standard global reflow.
+* To achieve a similar isolation effect in older browsers, you can fall back to applying containment manually:
+
+```css
+@supports not (content-visibility: auto) {
+ .board-column {
+ /* Manual fallback for containment */
+ contain: layout style paint;
+ }
+}
+```