Keep your coding agent up to date with the latest web best practices
Release v0.0.196
github-actions[bot]4f2b13e25c58
diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.jsonindex 3b16195..47002e3 100644--- a/.agents/plugins/marketplace.json+++ b/.agents/plugins/marketplace.json@@ -15,7 +15,7 @@"authentication": "ON_INSTALL"},"category": "Developer Tools",- "version": "0.0.195"+ "version": "0.0.196"}]}diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 07cf7d8..acbc2f2 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -9,7 +9,7 @@"name": "modern-web-guidance","source": "./","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.195"+ "version": "0.0.196"}]}diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex 3f8511b..9bcf681 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.195",+ "version": "0.0.196","author": {"name": "Google Chrome"}diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex d62315a..6690100 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "modern-web-guidance",- "version": "0.0.195",+ "version": "0.0.196","description": "Keep your coding agent up to date with the latest web best practices","author": {"name": "Google Chrome",diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.jsonindex 1cbd889..ebbfe04 100644--- a/.cursor-plugin/plugin.json+++ b/.cursor-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Modern Web Guidance is an agent skill and CLI tool designed to help AI coding agents build web applications using modern, secure, and high-performance APIs rather than outdated workarounds. Supported by the Google Chrome team, it injects expert-curated web platform best practices directly into an agent's context window to prevent the generation of bloated, legacy code.",- "version": "0.0.195",+ "version": "0.0.196","author": {"name": "Google Chrome"}diff --git a/.github/plugin/plugin.json b/.github/plugin/plugin.jsonindex 1cbd889..ebbfe04 100644--- a/.github/plugin/plugin.json+++ b/.github/plugin/plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Modern Web Guidance is an agent skill and CLI tool designed to help AI coding agents build web applications using modern, secure, and high-performance APIs rather than outdated workarounds. Supported by the Google Chrome team, it injects expert-curated web platform best practices directly into an agent's context window to prevent the generation of bloated, legacy code.",- "version": "0.0.195",+ "version": "0.0.196","author": {"name": "Google Chrome"}diff --git a/.grok-plugin/marketplace.json b/.grok-plugin/marketplace.jsonindex 54f2118..4e63f69 100644--- a/.grok-plugin/marketplace.json+++ b/.grok-plugin/marketplace.json@@ -8,7 +8,7 @@"name": "modern-web-guidance","source": "./","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.195"+ "version": "0.0.196"}]}diff --git a/README.md b/README.mdindex 3700f21..1712672 100644--- a/README.md+++ b/README.md@@ -85,72 +85,74 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro#### The full list<details>-<summary><strong>217 modern web features</strong></summary>+<summary><strong>232 modern web features</strong></summary>-### CSS & Layout (123 features)+### CSS & Layout (128 features)| | | || :--- | :--- | :--- |-| [::backdrop](https://web-platform-dx.github.io/web-features-explorer/features/backdrop/) | [content-visibility](https://web-platform-dx.github.io/web-features-explorer/features/content-visibility/) | [overscroll-behavior](https://web-platform-dx.github.io/web-features-explorer/features/overscroll-behavior/) |-| [::file-selector-button](https://web-platform-dx.github.io/web-features-explorer/features/file-selector-button/) | [contrast-color()](https://web-platform-dx.github.io/web-features-explorer/features/contrast-color/) | [prefers-color-scheme media query](https://web-platform-dx.github.io/web-features-explorer/features/prefers-color-scheme/) |-| [::placeholder](https://web-platform-dx.github.io/web-features-explorer/features/placeholder/) | [Cross-document view transitions](https://web-platform-dx.github.io/web-features-explorer/features/cross-document-view-transitions/) | [prefers-contrast media query](https://web-platform-dx.github.io/web-features-explorer/features/prefers-contrast/) |-| [::selection](https://web-platform-dx.github.io/web-features-explorer/features/selection/) | [currentColor](https://web-platform-dx.github.io/web-features-explorer/features/currentcolor/) | [prefers-reduced-motion media query](https://web-platform-dx.github.io/web-features-explorer/features/prefers-reduced-motion/) |-| [:dir()](https://web-platform-dx.github.io/web-features-explorer/features/dir-pseudo/) | [Custom highlights](https://web-platform-dx.github.io/web-features-explorer/features/highlight/) | [progress()](https://web-platform-dx.github.io/web-features-explorer/features/progress-function/) |-| [:has()](https://web-platform-dx.github.io/web-features-explorer/features/has/) | [Custom properties](https://web-platform-dx.github.io/web-features-explorer/features/custom-properties/) | [Relative colors](https://web-platform-dx.github.io/web-features-explorer/features/relative-color/) |-| [:host-context()](https://web-platform-dx.github.io/web-features-explorer/features/host-context/) | [display animation](https://web-platform-dx.github.io/web-features-explorer/features/display-animation/) | [rem](https://web-platform-dx.github.io/web-features-explorer/features/rem/) |-| [:is()](https://web-platform-dx.github.io/web-features-explorer/features/is/) | [Element-scoped view transitions](https://web-platform-dx.github.io/web-features-explorer/features/view-transitions-element-scoped/) | [resize (CSS property)](https://web-platform-dx.github.io/web-features-explorer/features/resize/) |-| [:modal](https://web-platform-dx.github.io/web-features-explorer/features/modal/) | [em unit](https://web-platform-dx.github.io/web-features-explorer/features/em-unit/) | [revert](https://web-platform-dx.github.io/web-features-explorer/features/revert-value/) |-| [:not()](https://web-platform-dx.github.io/web-features-explorer/features/not/) | [field-sizing](https://web-platform-dx.github.io/web-features-explorer/features/field-sizing/) | [revert-rule](https://web-platform-dx.github.io/web-features-explorer/features/revert-rule/) |-| [:nth-child() of <selector>](https://web-platform-dx.github.io/web-features-explorer/features/nth-child-of/) | [filter](https://web-platform-dx.github.io/web-features-explorer/features/filter/) | [Scroll marker target pseudo-classes](https://web-platform-dx.github.io/web-features-explorer/features/scroll-marker-targets/) |-| [:placeholder-shown](https://web-platform-dx.github.io/web-features-explorer/features/placeholder-shown/) | [flex-wrap: balance](https://web-platform-dx.github.io/web-features-explorer/features/flexbox-flex-wrap-balance/) | [Scroll method promises](https://web-platform-dx.github.io/web-features-explorer/features/scroll-promises/) |-| [:user-valid and :user-invalid](https://web-platform-dx.github.io/web-features-explorer/features/user-pseudos/) | [Flexbox](https://web-platform-dx.github.io/web-features-explorer/features/flexbox/) | [Scroll snap](https://web-platform-dx.github.io/web-features-explorer/features/scroll-snap/) |-| [:where()](https://web-platform-dx.github.io/web-features-explorer/features/where/) | [font-size](https://web-platform-dx.github.io/web-features-explorer/features/font-size/) | [Scroll snap events](https://web-platform-dx.github.io/web-features-explorer/features/scroll-snap-events/) |-| [@function](https://web-platform-dx.github.io/web-features-explorer/features/function/) | [font-size-adjust](https://web-platform-dx.github.io/web-features-explorer/features/font-size-adjust/) | [scroll-axis-lock](https://web-platform-dx.github.io/web-features-explorer/features/scroll-axis-lock/) |-| [@scope](https://web-platform-dx.github.io/web-features-explorer/features/scope/) | [Forced colors](https://web-platform-dx.github.io/web-features-explorer/features/forced-colors/) | [Scroll-driven animations](https://web-platform-dx.github.io/web-features-explorer/features/scroll-driven-animations/) |-| [@starting-style](https://web-platform-dx.github.io/web-features-explorer/features/starting-style/) | [Gradient interpolation](https://web-platform-dx.github.io/web-features-explorer/features/gradient-interpolation/) | [scroll-initial-target](https://web-platform-dx.github.io/web-features-explorer/features/scroll-initial-target/) |-| [@supports](https://web-platform-dx.github.io/web-features-explorer/features/supports/) | [Gradients](https://web-platform-dx.github.io/web-features-explorer/features/gradients/) | [scroll-target-group](https://web-platform-dx.github.io/web-features-explorer/features/scroll-target-group/) |-| [accent-color](https://web-platform-dx.github.io/web-features-explorer/features/accent-color/) | [Grid](https://web-platform-dx.github.io/web-features-explorer/features/grid/) | [scrollbar-color](https://web-platform-dx.github.io/web-features-explorer/features/scrollbar-color/) |-| [Active view transition](https://web-platform-dx.github.io/web-features-explorer/features/active-view-transition/) | [Grid lanes](https://web-platform-dx.github.io/web-features-explorer/features/grid-lanes/) | [scrollbar-gutter](https://web-platform-dx.github.io/web-features-explorer/features/scrollbar-gutter/) |-| [Alt text for generated content](https://web-platform-dx.github.io/web-features-explorer/features/alt-text-generated-content/) | [image-set()](https://web-platform-dx.github.io/web-features-explorer/features/image-set/) | [scrollbar-width](https://web-platform-dx.github.io/web-features-explorer/features/scrollbar-width/) |-| [Anchor position container queries](https://web-platform-dx.github.io/web-features-explorer/features/container-anchor-position-queries/) | [Individual transform properties](https://web-platform-dx.github.io/web-features-explorer/features/individual-transforms/) | [scrollend](https://web-platform-dx.github.io/web-features-explorer/features/scrollend/) |-| [Anchor positioning](https://web-platform-dx.github.io/web-features-explorer/features/anchor-positioning/) | [inherit](https://web-platform-dx.github.io/web-features-explorer/features/inherit-value/) | [scrollIntoView()](https://web-platform-dx.github.io/web-features-explorer/features/scroll-into-view/) |-| [Animations (CSS)](https://web-platform-dx.github.io/web-features-explorer/features/animations-css/) | [initial](https://web-platform-dx.github.io/web-features-explorer/features/initial-value/) | [Shadow parts](https://web-platform-dx.github.io/web-features-explorer/features/shadow-parts/) |-| [appearance](https://web-platform-dx.github.io/web-features-explorer/features/appearance/) | [interpolate-size](https://web-platform-dx.github.io/web-features-explorer/features/interpolate-size/) | [sibling-count() and sibling-index()](https://web-platform-dx.github.io/web-features-explorer/features/sibling-count/) |-| [aspect-ratio](https://web-platform-dx.github.io/web-features-explorer/features/aspect-ratio/) | [isolation](https://web-platform-dx.github.io/web-features-explorer/features/isolation/) | [Sticky positioning](https://web-platform-dx.github.io/web-features-explorer/features/sticky-positioning/) |-| [at-rule()](https://web-platform-dx.github.io/web-features-explorer/features/supports-at-rule/) | [Lab and LCH](https://web-platform-dx.github.io/web-features-explorer/features/lab/) | [Subgrid](https://web-platform-dx.github.io/web-features-explorer/features/subgrid/) |-| [attr()](https://web-platform-dx.github.io/web-features-explorer/features/attr/) | [light-dark()](https://web-platform-dx.github.io/web-features-explorer/features/light-dark/) | [System colors](https://web-platform-dx.github.io/web-features-explorer/features/system-color/) |-| [background-blend-mode](https://web-platform-dx.github.io/web-features-explorer/features/background-blend-mode/) | [line-clamp](https://web-platform-dx.github.io/web-features-explorer/features/line-clamp/) | [text-box](https://web-platform-dx.github.io/web-features-explorer/features/text-box/) |-| [border-radius](https://web-platform-dx.github.io/web-features-explorer/features/border-radius/) | [line-height](https://web-platform-dx.github.io/web-features-explorer/features/line-height/) | [text-wrap](https://web-platform-dx.github.io/web-features-explorer/features/text-wrap/) |-| [box-shadow](https://web-platform-dx.github.io/web-features-explorer/features/box-shadow/) | [linear() easing](https://web-platform-dx.github.io/web-features-explorer/features/linear-easing/) | [text-wrap: balance](https://web-platform-dx.github.io/web-features-explorer/features/text-wrap-balance/) |-| [calc-size()](https://web-platform-dx.github.io/web-features-explorer/features/calc-size/) | [Logical properties](https://web-platform-dx.github.io/web-features-explorer/features/logical-properties/) | [text-wrap: pretty](https://web-platform-dx.github.io/web-features-explorer/features/text-wrap-pretty/) |-| [Cascade layers](https://web-platform-dx.github.io/web-features-explorer/features/cascade-layers/) | [Masks](https://web-platform-dx.github.io/web-features-explorer/features/masks/) | [transition-behavior](https://web-platform-dx.github.io/web-features-explorer/features/transition-behavior/) |-| [clip-path](https://web-platform-dx.github.io/web-features-explorer/features/clip-path/) | [min(), max(), and clamp()](https://web-platform-dx.github.io/web-features-explorer/features/min-max-clamp/) | [Transitions (CSS)](https://web-platform-dx.github.io/web-features-explorer/features/transitions/) |-| [color-mix()](https://web-platform-dx.github.io/web-features-explorer/features/color-mix/) | [mix-blend-mode](https://web-platform-dx.github.io/web-features-explorer/features/mix-blend-mode/) | [Trigonometric functions (CSS)](https://web-platform-dx.github.io/web-features-explorer/features/trig-functions/) |-| [color-scheme](https://web-platform-dx.github.io/web-features-explorer/features/color-scheme/) | [Nesting](https://web-platform-dx.github.io/web-features-explorer/features/nesting/) | [unset](https://web-platform-dx.github.io/web-features-explorer/features/unset-value/) |-| [Conic gradients](https://web-platform-dx.github.io/web-features-explorer/features/conic-gradients/) | [Oklab and OkLCh](https://web-platform-dx.github.io/web-features-explorer/features/oklab/) | [user-select](https://web-platform-dx.github.io/web-features-explorer/features/user-select/) |-| [Container queries (size)](https://web-platform-dx.github.io/web-features-explorer/features/container-queries/) | [overflow-clip-margin](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip-margin/) | [View transitions](https://web-platform-dx.github.io/web-features-explorer/features/view-transitions/) |-| [Container scroll-state queries](https://web-platform-dx.github.io/web-features-explorer/features/container-scroll-state-queries/) | [overflow-wrap](https://web-platform-dx.github.io/web-features-explorer/features/overflow-wrap/) | [view-transition-class](https://web-platform-dx.github.io/web-features-explorer/features/view-transition-class/) |-| [Container style queries](https://web-platform-dx.github.io/web-features-explorer/features/container-style-queries/) | [overflow: clip](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip/) | [Viewport units](https://web-platform-dx.github.io/web-features-explorer/features/viewport-units/) |-| [Content](https://web-platform-dx.github.io/web-features-explorer/features/content/) | [overlay](https://web-platform-dx.github.io/web-features-explorer/features/overlay/) | [Web animations](https://web-platform-dx.github.io/web-features-explorer/features/web-animations/) |--### HTML & DOM (34 features)+| [::backdrop](https://web-platform-dx.github.io/web-features-explorer/features/backdrop/) | [contrast-color()](https://web-platform-dx.github.io/web-features-explorer/features/contrast-color/) | [prefers-reduced-motion media query](https://web-platform-dx.github.io/web-features-explorer/features/prefers-reduced-motion/) |+| [::file-selector-button](https://web-platform-dx.github.io/web-features-explorer/features/file-selector-button/) | [Cross-document view transitions](https://web-platform-dx.github.io/web-features-explorer/features/cross-document-view-transitions/) | [progress()](https://web-platform-dx.github.io/web-features-explorer/features/progress-function/) |+| [::placeholder](https://web-platform-dx.github.io/web-features-explorer/features/placeholder/) | [currentColor](https://web-platform-dx.github.io/web-features-explorer/features/currentcolor/) | [Relative colors](https://web-platform-dx.github.io/web-features-explorer/features/relative-color/) |+| [::selection](https://web-platform-dx.github.io/web-features-explorer/features/selection/) | [Custom highlights](https://web-platform-dx.github.io/web-features-explorer/features/highlight/) | [rem](https://web-platform-dx.github.io/web-features-explorer/features/rem/) |+| [:dir()](https://web-platform-dx.github.io/web-features-explorer/features/dir-pseudo/) | [Custom properties](https://web-platform-dx.github.io/web-features-explorer/features/custom-properties/) | [resize (CSS property)](https://web-platform-dx.github.io/web-features-explorer/features/resize/) |+| [:has()](https://web-platform-dx.github.io/web-features-explorer/features/has/) | [display animation](https://web-platform-dx.github.io/web-features-explorer/features/display-animation/) | [revert](https://web-platform-dx.github.io/web-features-explorer/features/revert-value/) |+| [:host-context()](https://web-platform-dx.github.io/web-features-explorer/features/host-context/) | [Element-scoped view transitions](https://web-platform-dx.github.io/web-features-explorer/features/view-transitions-element-scoped/) | [revert-rule](https://web-platform-dx.github.io/web-features-explorer/features/revert-rule/) |+| [:is()](https://web-platform-dx.github.io/web-features-explorer/features/is/) | [em unit](https://web-platform-dx.github.io/web-features-explorer/features/em-unit/) | [Scroll marker target pseudo-classes](https://web-platform-dx.github.io/web-features-explorer/features/scroll-marker-targets/) |+| [:modal](https://web-platform-dx.github.io/web-features-explorer/features/modal/) | [field-sizing](https://web-platform-dx.github.io/web-features-explorer/features/field-sizing/) | [Scroll method promises](https://web-platform-dx.github.io/web-features-explorer/features/scroll-promises/) |+| [:not()](https://web-platform-dx.github.io/web-features-explorer/features/not/) | [filter](https://web-platform-dx.github.io/web-features-explorer/features/filter/) | [Scroll snap](https://web-platform-dx.github.io/web-features-explorer/features/scroll-snap/) |+| [:nth-child() of <selector>](https://web-platform-dx.github.io/web-features-explorer/features/nth-child-of/) | [flex-wrap: balance](https://web-platform-dx.github.io/web-features-explorer/features/flexbox-flex-wrap-balance/) | [Scroll snap events](https://web-platform-dx.github.io/web-features-explorer/features/scroll-snap-events/) |+| [:placeholder-shown](https://web-platform-dx.github.io/web-features-explorer/features/placeholder-shown/) | [Flexbox](https://web-platform-dx.github.io/web-features-explorer/features/flexbox/) | [scroll-axis-lock](https://web-platform-dx.github.io/web-features-explorer/features/scroll-axis-lock/) |+| [:user-valid and :user-invalid](https://web-platform-dx.github.io/web-features-explorer/features/user-pseudos/) | [font-size](https://web-platform-dx.github.io/web-features-explorer/features/font-size/) | [Scroll-driven animations](https://web-platform-dx.github.io/web-features-explorer/features/scroll-driven-animations/) |+| [:where()](https://web-platform-dx.github.io/web-features-explorer/features/where/) | [font-size-adjust](https://web-platform-dx.github.io/web-features-explorer/features/font-size-adjust/) | [scroll-initial-target](https://web-platform-dx.github.io/web-features-explorer/features/scroll-initial-target/) |+| [@function](https://web-platform-dx.github.io/web-features-explorer/features/function/) | [Forced colors](https://web-platform-dx.github.io/web-features-explorer/features/forced-colors/) | [scroll-target-group](https://web-platform-dx.github.io/web-features-explorer/features/scroll-target-group/) |+| [@scope](https://web-platform-dx.github.io/web-features-explorer/features/scope/) | [Gradient interpolation](https://web-platform-dx.github.io/web-features-explorer/features/gradient-interpolation/) | [scrollbar-color](https://web-platform-dx.github.io/web-features-explorer/features/scrollbar-color/) |+| [@starting-style](https://web-platform-dx.github.io/web-features-explorer/features/starting-style/) | [Gradients](https://web-platform-dx.github.io/web-features-explorer/features/gradients/) | [scrollbar-gutter](https://web-platform-dx.github.io/web-features-explorer/features/scrollbar-gutter/) |+| [@supports](https://web-platform-dx.github.io/web-features-explorer/features/supports/) | [Grid](https://web-platform-dx.github.io/web-features-explorer/features/grid/) | [scrollbar-width](https://web-platform-dx.github.io/web-features-explorer/features/scrollbar-width/) |+| [accent-color](https://web-platform-dx.github.io/web-features-explorer/features/accent-color/) | [Grid lanes](https://web-platform-dx.github.io/web-features-explorer/features/grid-lanes/) | [scrollend](https://web-platform-dx.github.io/web-features-explorer/features/scrollend/) |+| [Active view transition](https://web-platform-dx.github.io/web-features-explorer/features/active-view-transition/) | [image-set()](https://web-platform-dx.github.io/web-features-explorer/features/image-set/) | [scrollIntoView()](https://web-platform-dx.github.io/web-features-explorer/features/scroll-into-view/) |+| [Alt text for generated content](https://web-platform-dx.github.io/web-features-explorer/features/alt-text-generated-content/) | [Individual transform properties](https://web-platform-dx.github.io/web-features-explorer/features/individual-transforms/) | [Shadow parts](https://web-platform-dx.github.io/web-features-explorer/features/shadow-parts/) |+| [Anchor position container queries](https://web-platform-dx.github.io/web-features-explorer/features/container-anchor-position-queries/) | [inherit](https://web-platform-dx.github.io/web-features-explorer/features/inherit-value/) | [sibling-count() and sibling-index()](https://web-platform-dx.github.io/web-features-explorer/features/sibling-count/) |+| [Anchor positioning](https://web-platform-dx.github.io/web-features-explorer/features/anchor-positioning/) | [initial](https://web-platform-dx.github.io/web-features-explorer/features/initial-value/) | [Sticky positioning](https://web-platform-dx.github.io/web-features-explorer/features/sticky-positioning/) |+| [Animations (CSS)](https://web-platform-dx.github.io/web-features-explorer/features/animations-css/) | [interpolate-size](https://web-platform-dx.github.io/web-features-explorer/features/interpolate-size/) | [Subgrid](https://web-platform-dx.github.io/web-features-explorer/features/subgrid/) |+| [appearance](https://web-platform-dx.github.io/web-features-explorer/features/appearance/) | [isolation](https://web-platform-dx.github.io/web-features-explorer/features/isolation/) | [System colors](https://web-platform-dx.github.io/web-features-explorer/features/system-color/) |+| [aspect-ratio](https://web-platform-dx.github.io/web-features-explorer/features/aspect-ratio/) | [Lab and LCH](https://web-platform-dx.github.io/web-features-explorer/features/lab/) | [text-box](https://web-platform-dx.github.io/web-features-explorer/features/text-box/) |+| [at-rule()](https://web-platform-dx.github.io/web-features-explorer/features/supports-at-rule/) | [light-dark()](https://web-platform-dx.github.io/web-features-explorer/features/light-dark/) | [text-decoration](https://web-platform-dx.github.io/web-features-explorer/features/text-decoration/) |+| [attr()](https://web-platform-dx.github.io/web-features-explorer/features/attr/) | [line-clamp](https://web-platform-dx.github.io/web-features-explorer/features/line-clamp/) | [text-decoration-skip-ink](https://web-platform-dx.github.io/web-features-explorer/features/text-decoration-skip-ink/) |+| [background-blend-mode](https://web-platform-dx.github.io/web-features-explorer/features/background-blend-mode/) | [line-height](https://web-platform-dx.github.io/web-features-explorer/features/line-height/) | [text-decoration-skip-ink: all](https://web-platform-dx.github.io/web-features-explorer/features/text-decoration-skip-ink-all/) |+| [background-clip: border-area](https://web-platform-dx.github.io/web-features-explorer/features/background-clip-border-area/) | [linear() easing](https://web-platform-dx.github.io/web-features-explorer/features/linear-easing/) | [text-decoration-skip-spaces](https://web-platform-dx.github.io/web-features-explorer/features/text-decoration-skip-spaces/) |+| [border-radius](https://web-platform-dx.github.io/web-features-explorer/features/border-radius/) | [Logical properties](https://web-platform-dx.github.io/web-features-explorer/features/logical-properties/) | [text-wrap](https://web-platform-dx.github.io/web-features-explorer/features/text-wrap/) |+| [box-shadow](https://web-platform-dx.github.io/web-features-explorer/features/box-shadow/) | [Masks](https://web-platform-dx.github.io/web-features-explorer/features/masks/) | [text-wrap: balance](https://web-platform-dx.github.io/web-features-explorer/features/text-wrap-balance/) |+| [calc-size()](https://web-platform-dx.github.io/web-features-explorer/features/calc-size/) | [min(), max(), and clamp()](https://web-platform-dx.github.io/web-features-explorer/features/min-max-clamp/) | [text-wrap: pretty](https://web-platform-dx.github.io/web-features-explorer/features/text-wrap-pretty/) |+| [Cascade layers](https://web-platform-dx.github.io/web-features-explorer/features/cascade-layers/) | [mix-blend-mode](https://web-platform-dx.github.io/web-features-explorer/features/mix-blend-mode/) | [transition-behavior](https://web-platform-dx.github.io/web-features-explorer/features/transition-behavior/) |+| [clip-path](https://web-platform-dx.github.io/web-features-explorer/features/clip-path/) | [Nesting](https://web-platform-dx.github.io/web-features-explorer/features/nesting/) | [Transitions (CSS)](https://web-platform-dx.github.io/web-features-explorer/features/transitions/) |+| [color-mix()](https://web-platform-dx.github.io/web-features-explorer/features/color-mix/) | [Oklab and OkLCh](https://web-platform-dx.github.io/web-features-explorer/features/oklab/) | [Trigonometric functions (CSS)](https://web-platform-dx.github.io/web-features-explorer/features/trig-functions/) |+| [color-scheme](https://web-platform-dx.github.io/web-features-explorer/features/color-scheme/) | [overflow-clip-margin](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip-margin/) | [unset](https://web-platform-dx.github.io/web-features-explorer/features/unset-value/) |+| [Conic gradients](https://web-platform-dx.github.io/web-features-explorer/features/conic-gradients/) | [overflow-wrap](https://web-platform-dx.github.io/web-features-explorer/features/overflow-wrap/) | [user-select](https://web-platform-dx.github.io/web-features-explorer/features/user-select/) |+| [Container queries (size)](https://web-platform-dx.github.io/web-features-explorer/features/container-queries/) | [overflow: clip](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip/) | [View transitions](https://web-platform-dx.github.io/web-features-explorer/features/view-transitions/) |+| [Container scroll-state queries](https://web-platform-dx.github.io/web-features-explorer/features/container-scroll-state-queries/) | [overlay](https://web-platform-dx.github.io/web-features-explorer/features/overlay/) | [view-transition-class](https://web-platform-dx.github.io/web-features-explorer/features/view-transition-class/) |+| [Container style queries](https://web-platform-dx.github.io/web-features-explorer/features/container-style-queries/) | [overscroll-behavior](https://web-platform-dx.github.io/web-features-explorer/features/overscroll-behavior/) | [Viewport units](https://web-platform-dx.github.io/web-features-explorer/features/viewport-units/) |+| [Content](https://web-platform-dx.github.io/web-features-explorer/features/content/) | [prefers-color-scheme media query](https://web-platform-dx.github.io/web-features-explorer/features/prefers-color-scheme/) | [Web animations](https://web-platform-dx.github.io/web-features-explorer/features/web-animations/) |+| [content-visibility](https://web-platform-dx.github.io/web-features-explorer/features/content-visibility/) | [prefers-contrast media query](https://web-platform-dx.github.io/web-features-explorer/features/prefers-contrast/) | |++### HTML & DOM (36 features)| | | || :--- | :--- | :--- |-| [:autofill](https://web-platform-dx.github.io/web-features-explorer/features/autofill/) | [<video>](https://web-platform-dx.github.io/web-features-explorer/features/video/) | [inert](https://web-platform-dx.github.io/web-features-explorer/features/inert/) |-| [:indeterminate](https://web-platform-dx.github.io/web-features-explorer/features/indeterminate/) | [Autonomous custom elements](https://web-platform-dx.github.io/web-features-explorer/features/autonomous-custom-elements/) | [Interest invokers](https://web-platform-dx.github.io/web-features-explorer/features/interest-invokers/) |-| [<audio>](https://web-platform-dx.github.io/web-features-explorer/features/audio/) | [blocking="render"](https://web-platform-dx.github.io/web-features-explorer/features/blocking-render/) | [Invoker commands](https://web-platform-dx.github.io/web-features-explorer/features/invoker-commands/) |-| [<details>](https://web-platform-dx.github.io/web-features-explorer/features/details/) | [Customizable <select>](https://web-platform-dx.github.io/web-features-explorer/features/customizable-select/) | [Lazy-loading media](https://web-platform-dx.github.io/web-features-explorer/features/loading-lazy-media/) |-| [<dialog closedby>](https://web-platform-dx.github.io/web-features-explorer/features/dialog-closedby/) | [Declarative shadow DOM](https://web-platform-dx.github.io/web-features-explorer/features/declarative-shadow-dom/) | [moveBefore()](https://web-platform-dx.github.io/web-features-explorer/features/move-before/) |-| [<dialog>](https://web-platform-dx.github.io/web-features-explorer/features/dialog/) | [Email, telephone, and URL <input> types](https://web-platform-dx.github.io/web-features-explorer/features/input-email-tel-url/) | [MutationObserver](https://web-platform-dx.github.io/web-features-explorer/features/mutationobserver/) |-| [<input type="checkbox" switch>](https://web-platform-dx.github.io/web-features-explorer/features/switch-control/) | [Fetch priority](https://web-platform-dx.github.io/web-features-explorer/features/fetch-priority/) | [Mutually exclusive <details> elements](https://web-platform-dx.github.io/web-features-explorer/features/details-name/) |-| [<input type="range">](https://web-platform-dx.github.io/web-features-explorer/features/input-range/) | [Form-associated custom elements](https://web-platform-dx.github.io/web-features-explorer/features/form-associated-custom-elements/) | [Popover](https://web-platform-dx.github.io/web-features-explorer/features/popover/) |-| [<link rel="expect">](https://web-platform-dx.github.io/web-features-explorer/features/link-rel-expect/) | [hidden="until-found"](https://web-platform-dx.github.io/web-features-explorer/features/hidden-until-found/) | [popover="hint"](https://web-platform-dx.github.io/web-features-explorer/features/popover-hint/) |-| [<link rel="preload">](https://web-platform-dx.github.io/web-features-explorer/features/link-rel-preload/) | [HTML in canvas](https://web-platform-dx.github.io/web-features-explorer/features/canvas-html/) | [Shadow DOM](https://web-platform-dx.github.io/web-features-explorer/features/shadow-dom/) |-| [<progress>](https://web-platform-dx.github.io/web-features-explorer/features/progress/) | [HTML setter methods](https://web-platform-dx.github.io/web-features-explorer/features/html-setters/) | |-| [<slot>](https://web-platform-dx.github.io/web-features-explorer/features/slot/) | [HTML streaming setters](https://web-platform-dx.github.io/web-features-explorer/features/html-streaming-setters/) | |--### JavaScript & APIs (60 features)+| [:autofill](https://web-platform-dx.github.io/web-features-explorer/features/autofill/) | [<slot>](https://web-platform-dx.github.io/web-features-explorer/features/slot/) | [HTML setter methods](https://web-platform-dx.github.io/web-features-explorer/features/html-setters/) |+| [:indeterminate](https://web-platform-dx.github.io/web-features-explorer/features/indeterminate/) | [<video>](https://web-platform-dx.github.io/web-features-explorer/features/video/) | [HTML streaming setters](https://web-platform-dx.github.io/web-features-explorer/features/html-streaming-setters/) |+| [<audio>](https://web-platform-dx.github.io/web-features-explorer/features/audio/) | [Autonomous custom elements](https://web-platform-dx.github.io/web-features-explorer/features/autonomous-custom-elements/) | [inert](https://web-platform-dx.github.io/web-features-explorer/features/inert/) |+| [<details>](https://web-platform-dx.github.io/web-features-explorer/features/details/) | [blocking="render"](https://web-platform-dx.github.io/web-features-explorer/features/blocking-render/) | [Interest invokers](https://web-platform-dx.github.io/web-features-explorer/features/interest-invokers/) |+| [<dialog closedby>](https://web-platform-dx.github.io/web-features-explorer/features/dialog-closedby/) | [Customizable <select>](https://web-platform-dx.github.io/web-features-explorer/features/customizable-select/) | [Invoker commands](https://web-platform-dx.github.io/web-features-explorer/features/invoker-commands/) |+| [<dialog>](https://web-platform-dx.github.io/web-features-explorer/features/dialog/) | [Declarative shadow DOM](https://web-platform-dx.github.io/web-features-explorer/features/declarative-shadow-dom/) | [Lazy-loading media](https://web-platform-dx.github.io/web-features-explorer/features/loading-lazy-media/) |+| [<input type="checkbox" switch>](https://web-platform-dx.github.io/web-features-explorer/features/switch-control/) | [Email, telephone, and URL <input> types](https://web-platform-dx.github.io/web-features-explorer/features/input-email-tel-url/) | [moveBefore()](https://web-platform-dx.github.io/web-features-explorer/features/move-before/) |+| [<input type="range">](https://web-platform-dx.github.io/web-features-explorer/features/input-range/) | [Fetch priority](https://web-platform-dx.github.io/web-features-explorer/features/fetch-priority/) | [MutationObserver](https://web-platform-dx.github.io/web-features-explorer/features/mutationobserver/) |+| [<input>](https://web-platform-dx.github.io/web-features-explorer/features/input/) | [focusgroup](https://web-platform-dx.github.io/web-features-explorer/features/focusgroup/) | [Mutually exclusive <details> elements](https://web-platform-dx.github.io/web-features-explorer/features/details-name/) |+| [<link rel="expect">](https://web-platform-dx.github.io/web-features-explorer/features/link-rel-expect/) | [Form-associated custom elements](https://web-platform-dx.github.io/web-features-explorer/features/form-associated-custom-elements/) | [Popover](https://web-platform-dx.github.io/web-features-explorer/features/popover/) |+| [<link rel="preload">](https://web-platform-dx.github.io/web-features-explorer/features/link-rel-preload/) | [hidden="until-found"](https://web-platform-dx.github.io/web-features-explorer/features/hidden-until-found/) | [popover="hint"](https://web-platform-dx.github.io/web-features-explorer/features/popover-hint/) |+| [<progress>](https://web-platform-dx.github.io/web-features-explorer/features/progress/) | [HTML in canvas](https://web-platform-dx.github.io/web-features-explorer/features/canvas-html/) | [Shadow DOM](https://web-platform-dx.github.io/web-features-explorer/features/shadow-dom/) |++### JavaScript & APIs (68 features)| | | || :--- | :--- | :--- |@@ -158,27 +160,30 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro| [<template for>](https://web-platform-dx.github.io/web-features-explorer/features/template-for/) | [Intl.DurationFormat](https://web-platform-dx.github.io/web-features-explorer/features/intl-duration-format/) | [Small, large, and dynamic viewport units](https://web-platform-dx.github.io/web-features-explorer/features/viewport-unit-variants/) || [AbortController and AbortSignal](https://web-platform-dx.github.io/web-features-explorer/features/aborting/) | [Keyboard events](https://web-platform-dx.github.io/web-features-explorer/features/keyboard-events/) | [Soft navigation performance entries](https://web-platform-dx.github.io/web-features-explorer/features/soft-navigations/) || [ARIA attribute reflection](https://web-platform-dx.github.io/web-features-explorer/features/aria-attribute-reflection/) | [Language detector](https://web-platform-dx.github.io/web-features-explorer/features/languagedetector/) | [Speculation rules](https://web-platform-dx.github.io/web-features-explorer/features/speculation-rules/) |-| [autocorrect](https://web-platform-dx.github.io/web-features-explorer/features/autocorrect/) | [LanguageModel](https://web-platform-dx.github.io/web-features-explorer/features/languagemodel/) | [Summarizer](https://web-platform-dx.github.io/web-features-explorer/features/summarizer/) |-| [Connection allowlists](https://web-platform-dx.github.io/web-features-explorer/features/connection-allowlists/) | [Lazy-loading images and iframes](https://web-platform-dx.github.io/web-features-explorer/features/loading-lazy/) | [SVG](https://web-platform-dx.github.io/web-features-explorer/features/svg/) |-| [corner-shape](https://web-platform-dx.github.io/web-features-explorer/features/corner-shape/) | [light-dark() image values](https://web-platform-dx.github.io/web-features-explorer/features/light-dark-image/) | [Temporal](https://web-platform-dx.github.io/web-features-explorer/features/temporal/) |-| [Credential management](https://web-platform-dx.github.io/web-features-explorer/features/credential-management/) | [Local network access](https://web-platform-dx.github.io/web-features-explorer/features/local-network-access/) | [text-fit](https://web-platform-dx.github.io/web-features-explorer/features/text-fit/) |-| [document.modelContext](https://web-platform-dx.github.io/web-features-explorer/features/document-modelcontext/) | [Long animation frames performance entries](https://web-platform-dx.github.io/web-features-explorer/features/long-animation-frames/) | [Top-level await](https://web-platform-dx.github.io/web-features-explorer/features/top-level-await/) |-| [email-verification](https://web-platform-dx.github.io/web-features-explorer/features/tmp-email-verification/) | [Navigation API](https://web-platform-dx.github.io/web-features-explorer/features/navigation/) | [touch-action](https://web-platform-dx.github.io/web-features-explorer/features/touch-action/) |-| [enterkeyhint](https://web-platform-dx.github.io/web-features-explorer/features/enterkeyhint/) | [Origin](https://web-platform-dx.github.io/web-features-explorer/features/origin/) | [Translator](https://web-platform-dx.github.io/web-features-explorer/features/translator/) |-| [Event timing performance entries](https://web-platform-dx.github.io/web-features-explorer/features/event-timing/) | [Page visibility](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility/) | [Trusted types](https://web-platform-dx.github.io/web-features-explorer/features/trusted-types/) |-| [Federated credential management](https://web-platform-dx.github.io/web-features-explorer/features/fedcm/) | [Page visibility state performance entries](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility-state/) | [User agent client hints](https://web-platform-dx.github.io/web-features-explorer/features/ua-client-hints/) |-| [Fetch](https://web-platform-dx.github.io/web-features-explorer/features/fetch/) | [Partitioned cookies](https://web-platform-dx.github.io/web-features-explorer/features/partitioned-cookies/) | [Web app origin migration](https://web-platform-dx.github.io/web-features-explorer/features/app-migration/) |-| [fetchLater](https://web-platform-dx.github.io/web-features-explorer/features/fetchlater/) | [Password credentials](https://web-platform-dx.github.io/web-features-explorer/features/password-credentials/) | [Web authentication](https://web-platform-dx.github.io/web-features-explorer/features/webauthn/) |-| [Form-associated WebMCP attributes](https://web-platform-dx.github.io/web-features-explorer/features/declarative-webmcp/) | [Permissions policy](https://web-platform-dx.github.io/web-features-explorer/features/permissions-policy/) | [Web authentication signal methods](https://web-platform-dx.github.io/web-features-explorer/features/webauthn-signals/) |-| [HTML processing instructions](https://web-platform-dx.github.io/web-features-explorer/features/html-processing-instructions/) | [Pointer Events](https://web-platform-dx.github.io/web-features-explorer/features/pointer-events-api/) | [Web Cryptography](https://web-platform-dx.github.io/web-features-explorer/features/web-cryptography/) |-| [image()](https://web-platform-dx.github.io/web-features-explorer/features/image-function/) | [Registered custom properties](https://web-platform-dx.github.io/web-features-explorer/features/registered-custom-properties/) | [WebAssembly](https://web-platform-dx.github.io/web-features-explorer/features/wasm/) |-| [inputmode](https://web-platform-dx.github.io/web-features-explorer/features/inputmode/) | [Resize observer](https://web-platform-dx.github.io/web-features-explorer/features/resize-observer/) | [webcrypto-modern-algos](https://web-platform-dx.github.io/web-features-explorer/features/tmp-webcrypto-modern-algos/) |-| [Interaction contentful paint performance entries](https://web-platform-dx.github.io/web-features-explorer/features/interaction-contentful-paint/) | [Sanitizer API](https://web-platform-dx.github.io/web-features-explorer/features/sanitizer/) | [WebOTP](https://web-platform-dx.github.io/web-features-explorer/features/web-otp/) |+| [autocorrect](https://web-platform-dx.github.io/web-features-explorer/features/autocorrect/) | [LanguageModel](https://web-platform-dx.github.io/web-features-explorer/features/languagemodel/) | [Subresource integrity](https://web-platform-dx.github.io/web-features-explorer/features/subresource-integrity/) |+| [border-shape](https://web-platform-dx.github.io/web-features-explorer/features/border-shape/) | [Lazy-loading images and iframes](https://web-platform-dx.github.io/web-features-explorer/features/loading-lazy/) | [Summarizer](https://web-platform-dx.github.io/web-features-explorer/features/summarizer/) |+| [Connection allowlists](https://web-platform-dx.github.io/web-features-explorer/features/connection-allowlists/) | [light-dark() image values](https://web-platform-dx.github.io/web-features-explorer/features/light-dark-image/) | [SVG](https://web-platform-dx.github.io/web-features-explorer/features/svg/) |+| [corner-shape](https://web-platform-dx.github.io/web-features-explorer/features/corner-shape/) | [Local network access](https://web-platform-dx.github.io/web-features-explorer/features/local-network-access/) | [Temporal](https://web-platform-dx.github.io/web-features-explorer/features/temporal/) |+| [Credential management](https://web-platform-dx.github.io/web-features-explorer/features/credential-management/) | [Long animation frames performance entries](https://web-platform-dx.github.io/web-features-explorer/features/long-animation-frames/) | [text-decoration-inset](https://web-platform-dx.github.io/web-features-explorer/features/tmp-text-decoration-inset/) |+| [cross-origin() for url()](https://web-platform-dx.github.io/web-features-explorer/features/url-cross-origin/) | [long-animation-frames-style-layout](https://web-platform-dx.github.io/web-features-explorer/features/tmp-long-animation-frames-style-layout/) | [text-fit](https://web-platform-dx.github.io/web-features-explorer/features/text-fit/) |+| [document.modelContext](https://web-platform-dx.github.io/web-features-explorer/features/document-modelcontext/) | [Navigation API](https://web-platform-dx.github.io/web-features-explorer/features/navigation/) | [Top-level await](https://web-platform-dx.github.io/web-features-explorer/features/top-level-await/) |+| [email-verification](https://web-platform-dx.github.io/web-features-explorer/features/tmp-email-verification/) | [Origin](https://web-platform-dx.github.io/web-features-explorer/features/origin/) | [touch-action](https://web-platform-dx.github.io/web-features-explorer/features/touch-action/) |+| [enterkeyhint](https://web-platform-dx.github.io/web-features-explorer/features/enterkeyhint/) | [Page visibility](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility/) | [Translator](https://web-platform-dx.github.io/web-features-explorer/features/translator/) |+| [Event timing performance entries](https://web-platform-dx.github.io/web-features-explorer/features/event-timing/) | [Page visibility state performance entries](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility-state/) | [Trusted types](https://web-platform-dx.github.io/web-features-explorer/features/trusted-types/) |+| [Federated credential management](https://web-platform-dx.github.io/web-features-explorer/features/fedcm/) | [Partitioned cookies](https://web-platform-dx.github.io/web-features-explorer/features/partitioned-cookies/) | [User agent client hints](https://web-platform-dx.github.io/web-features-explorer/features/ua-client-hints/) |+| [Fetch](https://web-platform-dx.github.io/web-features-explorer/features/fetch/) | [Password credentials](https://web-platform-dx.github.io/web-features-explorer/features/password-credentials/) | [Web app origin migration](https://web-platform-dx.github.io/web-features-explorer/features/app-migration/) |+| [fetchLater](https://web-platform-dx.github.io/web-features-explorer/features/fetchlater/) | [Permissions policy](https://web-platform-dx.github.io/web-features-explorer/features/permissions-policy/) | [Web authentication](https://web-platform-dx.github.io/web-features-explorer/features/webauthn/) |+| [Form-associated WebMCP attributes](https://web-platform-dx.github.io/web-features-explorer/features/declarative-webmcp/) | [Pointer Events](https://web-platform-dx.github.io/web-features-explorer/features/pointer-events-api/) | [Web authentication signal methods](https://web-platform-dx.github.io/web-features-explorer/features/webauthn-signals/) |+| [HTML processing instructions](https://web-platform-dx.github.io/web-features-explorer/features/html-processing-instructions/) | [Referrer policy](https://web-platform-dx.github.io/web-features-explorer/features/referrer-policy/) | [Web Cryptography](https://web-platform-dx.github.io/web-features-explorer/features/web-cryptography/) |+| [image()](https://web-platform-dx.github.io/web-features-explorer/features/image-function/) | [referrer-policy() for url()](https://web-platform-dx.github.io/web-features-explorer/features/url-referrer-policy/) | [WebAssembly](https://web-platform-dx.github.io/web-features-explorer/features/wasm/) |+| [inputmode](https://web-platform-dx.github.io/web-features-explorer/features/inputmode/) | [Registered custom properties](https://web-platform-dx.github.io/web-features-explorer/features/registered-custom-properties/) | [webcrypto-modern-algos](https://web-platform-dx.github.io/web-features-explorer/features/tmp-webcrypto-modern-algos/) |+| [integrity() for url()](https://web-platform-dx.github.io/web-features-explorer/features/url-integrity/) | [Resize observer](https://web-platform-dx.github.io/web-features-explorer/features/resize-observer/) | [WebOTP](https://web-platform-dx.github.io/web-features-explorer/features/web-otp/) |+| [Interaction contentful paint performance entries](https://web-platform-dx.github.io/web-features-explorer/features/interaction-contentful-paint/) | [Sanitizer API](https://web-platform-dx.github.io/web-features-explorer/features/sanitizer/) | |</details><details>-<summary><strong>185 real-world developer use cases</strong></summary>+<summary><strong>186 real-world developer use cases</strong></summary><h3>accessibility</h3>@@ -247,14 +252,10 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro<h3>js</h3>-- **[calculate-event-differentials](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/calculate-event-differentials.md)**: Calculate the duration and time remaining between dates and times.-- **[capture-location-agnostic-data](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/capture-location-agnostic-data.md)**: Record chronological data that should not change based on a user's location, such as birthdates, recurring alarms, or national holidays.+- **[calculate-event-differentials](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/calculate-event-differentials.md)**: Calculate elapsed or remaining time between dates and times, balance duration units, and format human-readable localized durations using Temporal.Duration and Intl.DurationFormat.+- **[capture-location-agnostic-data](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/capture-location-agnostic-data.md)**: Model location-agnostic calendar dates, wall-clock times, partial dates (recurring birthdays, credit card expirations), and recurring monthly intervals without time zone drift using Temporal Plain types.- **[coordinate-global-events](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/coordinate-global-events.md)**: Schedule future meetings or events by explicitly binding them to a geographical IANA time zone so that event times remain accurate regardless of Daylight Saving Time (DST) transitions, "skipped" or "repeated" hours during clock changes.-- **[format-human-readable-durations](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/format-human-readable-durations.md)**: Present elapsed time or durations to users in a readable, localized format, with the flexibility to display either detailed unit breakdowns (e.g., "1 hour and 30 minutes") or total unit counts (e.g., "90 minutes") depending on context.-- **[manage-recurring-intervals](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/manage-recurring-intervals.md)**: Calculate recurring intervals for subscription billings or payroll cycles, automatically adjusting for edge cases such as month-end transitions (e.g., adding one month to January 31st) to ensure accurate period calculations.-- **[model-partial-time-concepts](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/model-partial-time-concepts.md)**: Model date and time concepts that inherently lack a standard component (such as a specific year, day, or date) without using arbitrary placeholder values that introduce calculation errors.-- **[sequence-distributed-events](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/sequence-distributed-events.md)**: Sort timestamped events collected from servers, databases, or log files and measure the intervals between them.-- **[stabilize-reactive-state](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/stabilize-reactive-state.md)**: Manage task deadlines or schedules in data-driven views without unexpected side effects from shared mutable state.+- **[sort-high-precision-timestamps](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/sort-high-precision-timestamps.md)**: Parse, sort, and measure intervals between sub-millisecond or nanosecond ISO 8601 timestamps without Date truncation collisions using Temporal.Instant.- **[support-global-calendar-systems](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/js/support-global-calendar-systems.md)**: Display and calculate dates in non-Gregorian calendar systems (e.g., Islamic, Hebrew, or Chinese) accurately for international users.<h3>performance</h3>@@ -307,7 +308,8 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro- **[quick-sign-ins](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/quick-sign-ins.md)**: Authenticate returning users in place with their saved passkeys or passwords before navigating to a sign-in page or interrupting their workflow.- **[restrict-outbound-connections](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/restrict-outbound-connections.md)**: Restrict a page or worker to communicating only with an explicit allowlist of network endpoints to prevent unauthorized third-party requests and client-side data exfiltration.- **[sanitize-untrusted-html](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/sanitize-untrusted-html.md)**: Safely parse and display untrusted HTML content from user input by removing unsafe elements and attributes.-- **[trusted-types](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/trusted-types.md)**: Help prevent DOM-based XSS attacks by locking down dangerous DOM sinks so they reject raw strings and only accept policy-validated HTML.+- **[secure-external-subresources](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/secure-external-subresources.md)**: Verify the cryptographic integrity of external scripts, stylesheets, fonts, and images loaded from third-party origins, and control whether those requests send credentials or referrer URLs.+- **[trusted-types](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/trusted-types.md)**: Prevent DOM-based XSS attacks by defining a Trusted Types policy to sanitize untrusted HTML, using the policy when writing to DOM sinks like innerHTML, and enforcing Trusted Types via Content Security Policy.- **[validate-origins](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/validate-origins.md)**: Compare and validate web origins and sites safely across cross-document messages and URLs without error-prone string parsing.- **[verify-email-ownership](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/security/verify-email-ownership.md)**: Verify that a user owns an email address during account creation, sign-in, or recovery without sending a one-time passcode or magic link email.@@ -368,9 +370,12 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro<h3>ui-components</h3>+- **[card](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/card.md)**: Build a card component that adapts its presentation to its own available space and contents.- **[checkbox](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/checkbox.md)**: Style checkboxes, including custom icons, layout, colors, check/uncheck animations, while preserving native functionality and accessibility.- **[dark-mode-toggle](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/dark-mode-toggle.md)**: Build a dark mode toggle component that allows users to override their system color scheme preference for the current site.+- **[dialog](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/dialog.md)**: Build a modal or non-modal dialog component that is accessible, manages focus appropriately, and can be dismissed the way users expect on each platform.- **[hovercard](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/hovercard.md)**: Build a hovercard component that displays an interactive structured preview of the page a certain type of link (e.g. a user profile) will navigate to when hovered over.+- **[menu](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/menu.md)**: Build a menu component that displays a list of options or actions, with support for nested submenus.- **[navigation-drawer](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/navigation-drawer.md)**: Create a navigation drawer component that, when triggered from a menu button, slides in from the side overlaid on top of existing page content, and slides out when dismissed (by swiping away, tapping outside, or pressing escape).- **[persistent-app-tours](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/persistent-app-tours.md)**: Create persistent onboarding walkthroughs using tethered native overlays that stay open during user interaction.- **[persistent-toast-notifications](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/ui-components/persistent-toast-notifications.md)**: Create non-intrusive toast and overlay notifications for persistent, stackable messaging and state communication.@@ -388,6 +393,7 @@ _View an example:_ [the `navigation-drawer` guide](https://github.com/GoogleChro- **[color](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/color.md)**: Color guidance for the web, including contrast requirements, light and dark color schemes, Forced Colors Mode, and generating tints and shades from a base color.- **[complex-shapes](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/complex-shapes.md)**: Clip elements and their content to any free-form shape, like a symbol, brush stroke, or organic texture for more expressive designs.- **[contrast-color](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/contrast-color.md)**: Select a readable text color with sufficient contrast on a dynamic background color.+- **[custom-text-decorations](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/custom-text-decorations.md)**: Add text decorations such as underlines, overlines, strikethroughs, or entirely custom shapes, with reveal animations, custom offsets and end insets, and flexible ink skipping.- **[customize-scrollbar-color-and-thickness](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/customize-scrollbar-color-and-thickness.md)**: Customize the color or thickness of a scrollbar- **[dark-mode](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/dark-mode.md)**: Implement dark mode support in a way that respects the user's light/dark theme preference and adapts browser UI (e.g. scrollbars, form controls, etc)- **[equal-width-text-lines](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/visual-design/equal-width-text-lines.md)**: Make every line of a multi-line heading or lockup span the same width, as in poster-style or stacked-headline typography. Unlike justified text, the text itself is sized to the width rather than the spacing stretched@@ -537,16 +543,16 @@ We developed a robust eval harness to ensure that the content is **empirically p<!-- INJECT_EVAL_RESULTS_START -->| Date | Agent + Model | Tasks / Assertions | Unguided → Guided (Uplift) || :--- | :--- | :---: | :---: |+| Oct 25 | claude_code (sonnet-5-5) | 168 / 1422 | 56% → 90% (**+34pp**) |+| Oct 24 | antigravity_cli (gemini-4-argon) | 168 / 1373 | 65% → 95% (**+30pp**) |+| Oct 23 | codex_cli (gpt-6.1-sol) | 168 / 1422 | 58% → 85% (**+27pp**) |+| Oct 22 | claude_code (sonnet-5-5) | 168 / 1422 | 56% → 86% (**+30pp**) |+| Oct 22 | antigravity_cli (gemini-4-argon) | 172 / 1445 | 68% → 96% (**+28pp**) |+| Oct 20 | codex_cli (gpt-6.1-sol) | 172 / 1450 | 58% → 80% (**+22pp**) |+| Oct 20 | claude_code (sonnet-5-5) | 172 / 1450 | 54% → 89% (**+35pp**) |+| Oct 20 | antigravity_cli (gemini-4-argon) | 172 / 1450 | 65% → 95% (**+30pp**) || Oct 19 | codex_cli (gpt-6.1-sol) | 172 / 1445 | 56% → 83% (**+27pp**) || Oct 19 | claude_code (sonnet-5-5) | 171 / 1438 | 56% → 88% (**+32pp**) |-| Oct 19 | antigravity_cli (gemini-3.8-flash) | 166 / 704 | 59% → 88% (**+29pp**) |-| Oct 16 | codex_cli (gpt-6.1-sol) | 166 / 1382 | 58% → 84% (**+26pp**) |-| Oct 16 | claude_code (sonnet-5-5) | 166 / 1382 | 54% → 89% (**+35pp**) |-| Oct 16 | antigravity_cli (gemini-3.8-flash) | 166 / 1344 | 60% → 93% (**+33pp**) |-| Oct 14 | codex_cli (gpt-6.1-sol) | 165 / 1396 | 60% → 82% (**+22pp**) |-| Oct 14 | claude_code (sonnet-5-5) | 165 / 1406 | 58% → 89% (**+31pp**) |-| Oct 14 | antigravity_cli (gemini-3.8-flash) | 165 / 1336 | 63% → 91% (**+28pp**) |-| Oct 9 | codex_cli (gpt-6.1-sol) | 153 / 1284 | 58% → 77% (**+19pp**) |<!-- INJECT_EVAL_RESULTS_END -->diff --git a/gemini-extension.json b/gemini-extension.jsonindex 3f8511b..9bcf681 100644--- a/gemini-extension.json+++ b/gemini-extension.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Keep your coding agent up to date with the latest web best practices",- "version": "0.0.195",+ "version": "0.0.196","author": {"name": "Google Chrome"}diff --git a/kimi.plugin.json b/kimi.plugin.jsonindex 36b1333..b47c81a 100644--- a/kimi.plugin.json+++ b/kimi.plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Modern Web Guidance is an agent skill and CLI tool designed to help AI coding agents build web applications using modern, secure, and high-performance APIs rather than outdated workarounds. Supported by the Google Chrome team, it injects expert-curated web platform best practices directly into an agent's context window to prevent the generation of bloated, legacy code.",- "version": "0.0.195",+ "version": "0.0.196","author": {"name": "Google Chrome"},diff --git a/package.json b/package.jsonindex bf1bc61..da5f21b 100644--- a/package.json+++ b/package.json@@ -3,7 +3,7 @@"displayName": "Modern Web Guidance","description": "Keep your agent up to date on the latest web best practices.","license": "Apache-2.0",- "version": "0.0.195",+ "version": "0.0.196","publisher": "GoogleChrome","repository": {"url": "https://github.com/GoogleChrome/modern-web-guidance-src"diff --git a/plugin.json b/plugin.jsonnew file mode 100644index 0000000..4e751e2--- /dev/null+++ b/plugin.json@@ -0,0 +1,20 @@+{+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",+ "name": "modern-web-guidance",+ "version": "0.0.196",+ "description": "Keep your coding agent up to date with the latest web best practices",+ "author": {+ "name": "Google Chrome",+ "url": "https://developer.chrome.com/"+ },+ "homepage": "https://developer.chrome.com/docs/modern-web-guidance",+ "repository": "https://github.com/GoogleChrome/modern-web-guidance",+ "license": "Apache-2.0",+ "keywords": [+ "web",+ "html",+ "css",+ "javascript",+ "best-practices"+ ]+}diff --git a/skills/modern-web-guidance/guides/accessibility/accessibility.md b/skills/modern-web-guidance/guides/accessibility/accessibility.mdindex 603dfa8..00cb44a 100644--- a/skills/modern-web-guidance/guides/accessibility/accessibility.md+++ b/skills/modern-web-guidance/guides/accessibility/accessibility.md@@ -12,8 +12,10 @@ Contents:- [1. Content Navigability and Structure](#1-content-navigability-and-structure)- [Landmarks](#landmarks)- [Headings](#headings)- - [Lists and tables](#lists-and-tables)+ - [Lists](#lists)+ - [Tables](#tables)- [Skip links](#skip-links)+ - [Code example: good use of landmarks, headings, lists, tables, and a skip link](#code-example-good-use-of-landmarks-headings-lists-tables-and-a-skip-link)- [2. Semantic HTML and ARIA](#2-semantic-html-and-aria)- [Prefer native HTML](#prefer-native-html)- [ARIA roles and states](#aria-roles-and-states)@@ -26,11 +28,12 @@ Contents:- [Language](#language)- [Titles](#titles)- [Iframes](#iframes)+ - [Code Example: using the `<title>` and `<iframe>` elements](#code-example-using-the-title-and-iframe-elements)- [5. Keyboard and Focus Management](#5-keyboard-and-focus-management)- [Tab order and focusability](#tab-order-and-focusability)- [Keyboard handlers](#keyboard-handlers)- [Focus indicators](#focus-indicators)- - [Touch targets](#touch-targets)+ - [Target sizes](#target-sizes)- [6. Alternate Text and Media](#6-alternate-text-and-media)- [Images](#images)- [Inline SVGs](#inline-svgs)@@ -43,7 +46,7 @@ Contents:- [Input assistance and validation](#input-assistance-and-validation)- [8. Live Regions](#8-live-regions)- [Live Region Urgency Table](#live-region-urgency-table)- - [When to announce](#when-to-announce)+ - [When to announce](#when-to-announce-live-regions)- [Managing announcements](#managing-announcements)- [9. Color](#9-color)- [10. Typography](#10-typography)@@ -55,62 +58,93 @@ Contents:- [Automated checks](#automated-checks)- [Manual testing](#manual-testing)-## 1. Content Navigability and Structure### Landmarks-- **Place all content within landmarks**: Wrap each relevant part of the page in `<header>`, `<nav>`, `<main>`, `<aside>`, and `<footer>` elements so assistive-tech users can jump between regions.-- **Don't overuse landmarks**: Too many landmarks dilute their value. In particular, avoid labeling a `<section>` (which turns it into a `region` landmark) — `region` should be a last resort when no other landmark fits.+- **Place all content within landmarks:** Wrap each relevant part of the page in `<header>`, `<nav>`, `<main>`, `<aside>`, and `<footer>` elements so assistive-tech users can jump between regions. (1.3.6 Identify Purpose (Level AAA))+- **Use the correct landmark:** Use the `<header>` element as a container for introductory content, the `<nav>` element as a container for site-wide or in-page navigation links, the `<main>` element as a container for the main content of the page, the `<aside>` element as a container for content that is tangentially related to the main content, and the `<footer>` element as a container for information about the related content, such as the author, copyright information, and links to related documents. (1.3.1 Info and Relationships (Level A))+- **Use one `<main>` landmark per page:** Avoid using multiple `<main>` elements on a single page. (1.3.1 Info and Relationships (Level A))+- **Provide distinguishable accessible names for navigation regions:** If a page contains multiple `<nav>` elements, apply the `aria-label` attribute to each element and set its value to a distinguishable accessible name for the region. For example: `<nav aria-label="Primary">`, `<nav aria-label="Secondary">`, and so on. (Best practice)+- **Don't overuse landmarks:** Too many landmarks dilute their value. In particular, avoid labeling a `<section>` (which turns it into a `region` landmark) — `region` should be a last resort when no other landmark fits. (Best practice)### Headings-- **Structure main content with headings**: Use `<h1>`–`<h6>` sequentially (no jumping `<h1>` → `<h4>`) so screen-reader users get a navigable outline.-- **Don't use fake headings**: Never style `<div>` or `<span>` to look like headings without standard `<h1>`–`<h6>` tags.-- **Don't place headings inside `<summary>`, and avoid relying on headings inside `<details>` content**: Headings inside `<summary>` may be hidden from screen-reader heading lists and heading-navigation shortcuts entirely; headings inside `<details>` content are only reachable via heading navigation when the disclosure is open.- - **Caveat**: If a heading must act as a disclosure trigger, use a more robust alternative to `<details>`/`<summary>` instead, e.g. an accordion or a disclosure implemented with ARIA where the heading wraps the button.+- **Structure main content with headings:** Use `<h1>`–`<h6>` elements sequentially so screen reader users get a navigable outline. (1.3.1 Info and Relationships (Level A))+- **Mandatory - Don't use "fake" headings:** Never use `<div>` or `<span>` elements to look like headings without standard `<h1>`–`<h6>` elements. (1.3.1 Info and Relationships (Level A))+- **Avoid nesting headings incorrectly:** Make sure that, if a sub-heading is visually less important than its parent heading, its heading level is lower in the heading hierarchy. (1.3.1 Info and Relationships (Level A))+- **Use one `<h1>` element per page:** Use the `<h1>` element for the page's main heading. Having more than one `<h1>` element on a page makes it difficult for screen reader users to identify the actual main heading. (Best Practice)+ - **Caveat:** If a page includes a modal dialog that is marked up using the `<dialog>` element, `role="dialog"`, or `role="alertdialog"`, it is fine to mark up its main heading using the `<h1>` element because the dialog is a new window that is separate from the page.+- **Avoid "skipped" heading levels:** Avoid jumping directly from (for example) `<h1>` → `<h4>` to avoid breaking the logical hierarchy. (Best Practice)+- **Avoid placing headings inside the `<summary>` element:** Some browsers still expose this element as a button, which removes all roles from its children including headings. If a heading must act as a disclosure trigger, use an accordion or a disclosure implemented with ARIA where the heading element wraps the button, rather than use the `<details>` and `<summary>` elements. (Best Practice)++### Lists-### Lists and tables+- **Use lists for repeated, contiguous content:** `<ul>`/`<ol>` give assistive tech a count of listitems up front and let users skip the entire list. (1.3.1 Info and Relationships (Level A))+- **Use the correct list element:** Use the `<ul>` element for unordered lists where the order of the items is **not** important (such as a list of related products), and use the `<ol>` element for ordered lists where the order of the content **is** important (such as a list of instructions). (1.3.1 Info and Relationships (Level A))+- **Don't use lists for non-list content:** Do not use list markup to mark up separate paragraphs of text, as screen readers will announce list information when they encounter lists, therefore leading to a screen reader hearing potentially confusing and redundant information about the related content. (1.3.1 Info and Relationships (Level A))+- **Don't use lists for checkboxes and radio buttons:** When marked up correctly, screen readers will already announce the number of checkboxes or radio buttons, as well as the number of the currently focused checkbox / radio button in the set, even though there is no list markup. Additional list markup will lead to duplication. (1.3.1 Info and Relationships (Level A))-- **Use lists for repeated, contiguous content**: `<ul>`/`<ol>` give assistive tech a count up front and let users skip the entire group.-- **Semantic Tables**: Use `<caption>` and `<th scope="col">` (or `<th scope="row">`) for data tables.-- **Don't use tables for layout**: Use CSS Grid/Flexbox for visual layouts.+### Tables++- **Do use the correct table elements:** Use the `<table>` element to identify the table, the `<caption>` element to provide a title and accessible name for the description, the `<tr>` element to identify individual rows in the table, and the `<th>` and `<td>` elements to identify header and data cells respectively. (1.3.1 Info and Relationships (Level A))+- **Do use the `scope` attribute on `<th>` elements:** The `scope` attribute indicates whether the `<th>` element represents a row header (`<th scope="row">`) or a column header (`<th scope="col">`). (1.3.1 Info and Relationships (Level A))+- **Mandatory - Don't use tables for layout:** Screen readers will announce redundant information about the layout, which may be confusing for screen reader users, while the use of tabular markup has an impact on the reading and keyboard focus order of content. Use CSS Grid/Flexbox for visual layouts instead. (1.3.1 Info and Relationships (Level A))+- **Avoid overly-complex tables:** Spanned rows, spanned columns, nested tables, and expandable / collapsible rows can make sense visually and meet the related WCAG success criterion, but the overall structure can be disorienting and difficult to navigate for screen reader users. In such cases, break tables up into smaller tables that are easier and more efficient to navigate. (Best Practice)### Skip links-- **Provide skip links** prior to repeated content like site headers with navigation or long/infinite lists, so that keyboard users can easily bypass them. Make sure the target is focusable (e.g. `<main id="content" tabindex="-1">`).+- **Provide skip links** prior to repeated content like site headers with navigation or long/infinite lists, so that keyboard users can easily bypass them. (2.4.1 Bypass Blocks (Level A))+ - **Caveat:** Sometimes screen magnifiers do not follow the focus when a skip link’s target is not normally focusable.+ The recommended workaround is to make the target programmatically focusable, but not a part of the tab order, using `tabindex="-1"`.+ If the target contains focusable elements, this creates another usability issue as clicking within the target will always set the **sequential focus navigation start point** to the target rather than at a point between focusable elements.+ A solution that satisfies both user expectations is to make the first meaningful element within the intended target the actual target of the skip link with `tabindex="-1"`, for example a heading (`<h1 id="content" tabindex="-1">`).+ Beware that any content prior to such an element will be skipped, including other relevant content within the targeted section, and this creates usability gaps for other assistive tech users.+- **Avoid using skip links where they are not needed:** A set of pages whose only common element is a single link to the Home page does not need a skip link. (Best Practice)+- **Avoid overusing skip links:** A single skip link, or two skip links to cover the primary and secondary sets of common navigation links, is usually sufficient on a single page. Multiple unnecessary skip links add to the number of <kbd>Tab</kbd> stops to a page, which causes frustration for people who use the keyboard alone for navigation. (Best Practice)```html<!-- Good: Skip to main content --><a href="#content" class="skip-link">Skip to main content</a>-<main id="content" tabindex="-1">...</main>+<main id="content">...</main>```+### Code Example: good use of landmarks, headings, lists, tables, and a skip link+```html<!-- Good: Semantic landmarks, heading hierarchy, skip link --><header>- <a href="#content" class="skip-link visually-hidden">Skip to content</a>+ <a href="#platform-dashboard" class="skip-link visually-hidden">Skip to content</a><nav aria-label="Primary"><ul><li><a href="/">Home</a></li></ul></nav></header>-<main id="content" tabindex="-1">- <h1>Platform Dashboard</h1>+<main>+ <h1 id="platform-dashboard" tabindex="-1">Platform Dashboard</h1><section><h2>User Statistics</h2><table><caption>Monthly active users</caption>- <tr>- <th scope="col">Month</th>- <th scope="col">Users</th>- </tr>- <tr>- <td>January</td>- <td>12,000</td>- </tr>+ <thead>+ <tr>+ <th scope="col">Month</th>+ <th scope="col">Users</th>+ </tr>+ </thead>+ <tbody>+ <tr>+ <td>January</td>+ <td>12,000</td>+ </tr>+ </tbody></table>+ <h3>Notes</h3>+ <ul>+ <li>Results do not include users without active subscriptions</li>+ <li>Results are accurate as of 31 December 2025</li>+ </ul></section></main>```@@ -119,18 +153,21 @@ Contents:### Prefer native HTML-- **Prefer HTML elements and attributes to ARIA**: A native element comes with the right role and behavior. `<button>` already implies `role="button"`; `required` already implies `aria-required`.-- **Don't use ARIA when native HTML exists**: Avoid `<div role="button">` or `<a role="button">` if `<button>` works.-- **Don't add redundant ARIA roles or properties**: Avoid `<ul role="list">`, `<nav role="navigation">`, or `<input required aria-required="true">`.- - **Caveat**: Safari removes list semantics from `<ul>`/`<ol>` outside `<nav>` when `list-style: none` or `display: flex`/`grid` is applied. In that case `role="list"` is required to restore them.+- **Prefer HTML elements and attributes to ARIA:** Avoid `<div role="button">` or `<a role="button">` and use `<button>` instead. Native HTML elements and attributes already have the correct role and behavior, including keyboard support, built-in by default. `<button>` already implies `role="button"`, `required` already implies `aria-required`, and no additional JavaScript is required to ensure the correct role and behavior is supported. (Best Practice)+ - **Caveat:** ARIA is required when the related feature is not available in HTML, for example there are no HTML elements explicitly intended for building a tabbed navigation widget, but ARIA includes appropriate role and state properties for this purpose.+- **Don't add redundant ARIA roles or properties:** Avoid `<ul role="list">`, `<nav role="navigation">`, and `<input required aria-required="true">`. (Best Practice)+ - **Caveat:** Safari removes list semantics from `<ul>`/`<ol>` outside `<nav>` when `list-style: none` or `display: flex`/`grid` is applied. In that case `role="list"` is required to restore them.+- **Don't apply interactive ARIA roles to structural HTML elements:** Use `<li><span role="button">Button in a list</span></li>`, not `<li role="button">Button in a list</li>`, to avoid breaking the container list semantics. (4.1.2 Name, Role, Value (Level A))+ - **Caveat:** It is acceptable to apply ARIA roles to structural HTML elements that have similar semantics, for example a tree view: `<ul role="tree"><li role="treeitem">…</li>…</ul>`.### ARIA roles and states-- **Match ARIA implementations to actual behavior**: If you set `role="tab"`, the element must behave like a tab — including keyboard interactions. Many ARIA patterns can't be implemented in CSS alone and need JavaScript.-- **Manage Toggle States**: Utilize `aria-expanded` and `aria-pressed` to communicate toggle states for custom controls.-- **Be deliberate about `disabled` vs `aria-disabled`**: `disabled` removes the element from the focus order entirely (and `tabindex="0"` won't bring it back), which is often wrong for toolbar buttons or links. `aria-disabled="true"` keeps the element focusable so users can land on it and learn it's disabled.-- **Don't hide interactive elements from screen readers**: Avoid `aria-hidden="true"` or `role="presentation"` on elements that can receive focus.-- **Don't assume custom elements have no ARIA**: Custom elements can attach ARIA via `ElementInternals`, which some automated test tools can't see — so the absence of `role`/`aria-*` attributes in markup doesn't prove the element has no semantics. Verify with the browser's accessibility-tree inspector.+- **Match ARIA implementations to actual behavior:** When applying `role="tab"` to an element, it must then behave like a tab — including keyboard interactions. Many ARIA patterns can't be implemented in CSS alone and need JavaScript. (4.1.2 Name, Role, Value (Level A))+- **Manage toggle states:** Utilize `aria-expanded` and `aria-pressed` to communicate toggle states for custom controls. (4.1.2 Name, Role, Value (Level A))+- **Be deliberate about `disabled` vs `aria-disabled`:** `disabled` removes the element from the focus order entirely (and `tabindex="0"` won't bring it back), which is often wrong for toolbar buttons or links. `aria-disabled="true"` keeps the element focusable so users can land on it and learn it's disabled, but because it only communicates state to assistive technologies, you must also prevent activation (such as pointer clicks and keyboard triggers) in JavaScript. (4.1.2 Name, Role, Value (Level A))+- **Mandatory - Don't hide interactive elements from screen readers:** Do not apply `aria-hidden="true"` to interactive elements that receive focus, or to their parent elements. (4.1.2 Name, Role, Value (Level A))+- **Mandatory - Don't suppress the roles of interactive elements:** Applying `role="presentation"` or `role="none"` to an interactive element strips its semantics. The element will still be exposed to assistive technologies and announced by screen readers, but its role and any state information will not be, which results in confusion and potentially unexpected behavior. (4.1.2 Name, Role, Value (Level A))+- **Don't assume custom elements have no ARIA:** Custom elements can attach ARIA via `ElementInternals`, which some automated test tools can't see — so the absence of `role`/`aria-*` attributes in markup doesn't prove the element has no semantics. Verify with the browser's accessibility-tree inspector. (Best Practice)## 3. Accessible Names and Descriptions@@ -138,29 +175,50 @@ Every interactive element and some landmarks need an accessible name, and many b### Naming mechanisms-- **Prefer native naming mechanisms**: `<label>` for form controls, `<caption>` for `<table>`, `<legend>` for `<fieldset>`, `<figcaption>` for `<figure>`.-- **Explicitly associate `<label>` with its control via `for`/`id`**, even when nesting the input inside the label — explicit association improves assistive-tech support.-- **Prefer `aria-labelledby` over `aria-label` when a visible label exists**: avoids duplication, improves maintainability, and translates better.-- **Don't use `title` or `placeholder` as a naming mechanism.**-- **Don't put `aria-label`/`aria-labelledby` on elements that shouldn't be named** — e.g. plain `<div>`, `<span>`, or custom elements without a role. Custom elements may have an implicit role set via `ElementInternals`, so the absence of a `role` attribute isn't conclusive.+- **Prefer native naming mechanisms:** `<label>` for form controls, `<caption>` for `<table>`, `<legend>` for `<fieldset>`, `<figcaption>` for `<figure>`. (Best Practice)+- **Explicitly associate `<label>` with its control via `for`/`id`:** As well as ensuring the control is appropriately labeled by the contents of the `<label>` element, this results in a larger target area for people to activate the label _or_ its related control to move focus to the control, which isn't globally supported with other forms of labeling (such as using the `aria-labelledby` attribute). Additionally, some assistive technologies, particularly voice recognition software, require the `for`/`id` relationship to be explicitly set, even if an equivalent accessibility-supported approach (such as nesting an `<input>` inside a `<label>`) is taken. (4.1.2 Name, Role, Value (Level A))+- **Prefer `aria-labelledby` over `aria-label` when a visible label exists:** This avoids duplication, improves maintainability, and translates better. (Best Practice)+- **Don't use `title` as a naming mechanism:** The value of this attribute is only displayed on mouse hover, and cannot be displayed or otherwise accessed using the keyboard in any browser. (Best Practice)+ - **Caveat:** `<iframe>` is an exception, as the `title` attribute is the standard way of providing an accessible name for this element.+- **Don't use `placeholder` as a naming mechanism:** While the value of this attribute is initially displayed inside an `<input>` or `<textarea>`, it disappears as soon as the user enters text into the field, meaning that there is no longer a visual cue as to what the field represents. The contrast between `placeholder` text and its background in most browsers is very low, and therefore is difficult for people to perceive. (3.3.2 Labels or Instructions (Level A))+- **Don't put `aria-label`/`aria-labelledby` on elements that shouldn't be named:** Examples include plain `<div>`, `<span>`, and other custom elements without a role. These attributes are only intended for providing accessible names for elements that have explicit or implicit widget (for example, button, link, and tab), landmark, image, or iframe roles. (1.3.1 Info and Relationships (Level A))+ - **Caveat:** Custom elements may have an implicit role set via `ElementInternals`, so the absence of a `role` attribute isn't conclusive.### Choosing the name-- **Prefer to reuse the same accessible name for hyperlinks that share an `href`.**-- **Use visually hidden text to disambiguate controls** that look identical visually but do different things (e.g. multiple "Edit" buttons in a list).-- **Don't reuse an accessible name across controls with different effects in the same view** (close buttons for two different open dialogs are fine because only one is reachable at a time; multiple “Edit” buttons for different content is not).-- **Don't reuse an accessible name across hyperlinks pointing to different `href`s.**-- **Don't pack descriptions, error messages, or instructions into the label.**-- **Don't repeat state already exposed via ARIA** (`aria-expanded`, `aria-checked`, `aria-selected`, `aria-pressed`) inside the accessible name — it creates redundancy and ambiguity.-- **Don't include the role name in the label**: `<nav aria-label="Primary navigation">` reads as "Primary navigation navigation."+- **Avoid inconsistent link text:** If multiple hyperlinks direct users to the same target page, make sure each link has the same accessible name, which should typically be the same as its visible link text. For example, if the target page for a link is `profile.html`, make sure that all links have an accessible name of "My Profile" **or** "Profile"; do not use "My Profile" in one instance, and "Profile" in the other. (Best Practice)+- **Disambiguate controls that look visually identical but which perform different actions by their accessible name:** For example, a page may include multiple "Edit" buttons, each of which triggers functionality to perform a different action, such as edit the user's name, edit the user's password, and edit the user's address. While it may be visually obvious from the surrounding content what the purpose of these buttons might be, screen reader users may only hear "Edit, button". Techniques to resolve this include the following: (4.1.2 Name, Role, Value (Level A))+ - **Use visually hidden text:** The text is included in the DOM but is visually hidden using CSS. For example `<button>Edit <span class="visually-hidden">first name</span></button>`. Refer to the [code example: visually hidden utility](#code-example-visually-hidden-utility) for the full CSS.+ - **Apply the `aria-label` attribute to the control:** The value of this attribute should then include the visible text as well as important contextual information, for example `<button aria-label="Edit name">Edit</button>`, `<button aria-label="Edit address">Edit</button>`, and so on.+ - **Use the `aria-labelledby` or `aria-describedby` attribute to associate the control with the content it relates to:** Chaining IDs in `aria-labelledby` appends the related text to the control's accessible name (for example, `<p id="firstName">First name</p> <button id="editFirstName" aria-labelledby="editFirstName firstName">Edit</button>`), whereas `aria-describedby` provides the context as an accessible description (`<p id="firstName">First name</p> <button aria-describedby="firstName">Edit</button>`).+- **Do include a control's visible text in its accessible name:** Any visible text used to label a control must be included exactly as written in the control's accessible name. The accessible name can include additional information before or after the visible text, but the visible text itself must not differ. For example, the accessible name for a link containing the link phrase "Read more" can be "Read more about [subject]", because the visible text is included without modification. However, the accessible name cannot be "Read some more about [subject]", because the term "some" appears between the words "Read" and "more", which is not reflected in the visible text. (2.5.3 Label in Name (Level A))+- **Don't reuse an accessible name across controls with different effects in the same view:** Make sure that each accessible name is disambiguated. (4.1.2 Name, Role, Value (Level A))+ - **Caveat:** Having two separate buttons with the accessible name of "Close" in two separate dialog boxes is fine, because only one dialog box is reachable at a time; however, multiple "Edit" buttons for different effects in the same dialog box is not.+- **Don't reuse an accessible name across hyperlinks that point to different `href` targets:** For example, avoid `<a href="annualreport2025.html">Annual Report</a>` and `<a href="annualreport2026.html">Annual Report</a>`. Use `<a href="annualreport2025.html">Annual Report 2025</a>` and `<a href="annualreport2026.html">Annual Report 2026</a>` (or an equivalent technique for disambiguating controls) instead.+- **Don't pack descriptions, error messages, or instructions into the label:** Verbose labels confuse and frustrate people who use screen readers. Instead, use the `aria-describedby` attribute to programmatically associate any additional content with the field. For example: `<label for="yourComments">Your comments</label><p id="yourCommentsWarning">Please do not include any personal information in this field.</p><textarea id="yourComments" aria-describedby="yourCommentsWarning"></textarea>`. Screen readers will then announce the label first, followed by the control type, and only then announce additional information that a user can skip if they are already aware of it. (Best Practice)+- **Don't repeat state information already exposed by ARIA inside the label:** Examples include information exposed via the `aria-expanded`, `aria-checked`, `aria-selected`, `aria-pressed`, and similar attributes. This creates duplication, redundancy, and ambiguity. (Best Practice)+- **Don't include the role name in the label:** This will lead to duplication. For example, `<nav aria-label="Primary navigation">` will be read by screen readers as "Primary navigation, navigation". (Best Practice)### Descriptions-- **Don't include interactive elements in an `aria-describedby` target** unless their text content reads sensibly as a description on its own (e.g. if a link’s text is the same as how it’s labelled elsewhere, it can be included within a description).+- **Identify instructions, error messages, and any other important information explicitly related to a control as a description:** Examples of descriptions include: (1.3.1 Info and Relationships (Level A))+ - A list of password requirements when creating an account+ - An error message related to a field in a previously submitted form+ - Additional instructions, such as "You must agree to the terms and conditions before you can submit the form"+- **Make sure the description is available to assistive technologies when the related element receives focus:** Take one of the following approaches (1.3.1 Info and Relationships (Level A)):+ - If the description is already visible on the page, programmatically associate it with the element using the `aria-describedby` attribute.+ - If the description is not visible on the page and is explicitly for screen reader users (in other words, when providing a visible description is not appropriate or useful), apply the `aria-description` attribute to the element and use it to provide an appropriate description.+- **Avoid including a description for every element:** if the primary label already provides sufficient information (such as "First name"), any additional description is likely to be redundant. (Best Practice)+ - **Caveat:** Inline error messages associated with controls, such as error messages below / above text fields, as well as secondary labels that should be announced when the element receives focus, are exceptions.+- **Avoid including information in the description that is already provided by attributes applied to the element:** For example, including "This is a required field" as a description for an `<input>` element that already includes the `required` attribute will lead to duplicate announcements. (Best Practice)+ - **Caveat:** `aria-invalid="true"` is an exception; many screen readers announce "invalid" when they reach an `<input>` that includes this attribute set to `true`, which indicates that the field is in error. However, it does not indicate what the error is. In such cases, a description (the actual human readable error message) is required. This attribute should only be applied and set to true when the error message is present.+- **Avoid including interactive elements in an `aria-describedby` target** unless the content of the element reads sensibly as a description on its own. For example: (Best Practice)+ - This is acceptable, as the entire text string makes sense when announced: `<p id="description">I understand the <a href="tandc.html">terms and conditions</a>.</p>`+ - This is not appropriate, as the description will be announced as "Please don't include personal information in this field. Learn more.", where "Learn more" will be announced out of its intended context: `<p id="description">Please don't include personal information in this field. <a href="…">Learn more</a></p>`. Instead, only include the plain text in the referenced description: `<p><span id="description">Please don't include personal information in this field.</span> <a href="…">Learn more</a></p>`.### Code Example: Visually Hidden Utility-A `.visually-hidden` utility lets you provide text for screen readers without rendering it visually. It's commonly used for skip links, additional context on icon-only buttons, and supplementary labels.+A `.visually-hidden` utility provides text for screen readers without rendering it visually. It's commonly used for skip links, additional context on icon-only buttons, and supplementary labels.```css/* Hides content visually but keeps it in the accessibility tree.@@ -185,18 +243,25 @@ When the hidden content is focusable (skip links, focus-receiving wrappers), the### Language-- **Declare Visual Language**: Always set `<html lang="en">` (or appropriate code).-- **Inline Language Switches**: Use `lang="..."` for block quotes or text in different languages.+- **Do declare the page's human language:** Always apply the `lang` attribute to the page's `<html>` element, and always set it to the primary human language of the page's content. For example, `<html lang="en">`. (3.1.1 Language of Page (Level A))+- **Do declare changes in the page's human language:** If there is a language change on the page, apply the `lang` attribute to the parent/container element for the affected content, and set the value of this attribute to the shortcode for the language of the affected content. For example: `<p>In Germany, you may be greeted by someone saying <span lang="de">Guten Morgen</span>.</p>`. (3.1.2 Language of Parts (Level AA))+- **Don't set the value of the `lang` attribute to a value that doesn't match the human language of the content:** This causes screen readers and other text-to-speech software to announce the content in a non-understandable manner. (3.1.1 Language of Page (Level A), 3.1.2 Language of Parts (Level AA))### Titles-- **Unique Page Titles**: Front-load unique context in `<title>` (e.g., `Page Topic | Site Name`).-- **Update document title on Page Transitions in SPAs**: Shift focus to updated titles.+- **Do include the `<title>` element in the `<head>` section for all pages:** This includes pages embedded into a document using an `<iframe>`. (2.4.2 Page Titled (Level A))+- **Provide unique page titles:** Every page should have its own title that unambiguously reflects the page's purpose or content. (2.4.2 Page Titled (Level A))+- **Front-load the page's `<title>` with unique content:** For example, `<title>Page Topic | Site Name</title>`. (Best Practice)+- **Update single-page application (SPA) titles during page transitions:** For example, if the page title is `<title>Contact Us</title>` when a contact form is displayed, update the title to `<title>Thank you for contacting us!</title>` when the form is successfully submitted. (2.4.2 Page Titled (Level A))+- **Don't include an empty `<title>` element in the `<head>` section of a page:** No matter how short or inconsequential a page appears, do not use `<title></title>`. Page titles appear in the browser tab, so pages are distinguishable when users have multiple tabs open, and are typically announced by screen readers when the page is opened. (2.4.2 Page Titled (Level A))+- **Avoid using the same title for multiple pages, or using ambiguous page titles:** In such cases, pages are indistinguishable without reviewing the actual page content itself. (2.4.2 Page Titled (Level A))### Iframes-- **IFrame Titles**: Always provide a descriptive `title="..."` for `<iframe>` elements.-- **Don't Disable iframe Scrolling**: Avoid `scrolling="no"` (deprecated) or `overflow: hidden` on iframes. Users who zoom in or enlarge text need to scroll to reach content that overflows.+- **Do provide a descriptive `title` for `<iframe>` elements:** All `<iframe>` elements should include a `title` attribute set to a value that unambiguously describes the contents of the `<iframe>`. (4.1.2 Name, Role, Value (Level A))+- **Don't disable iframe scrolling** using `scrolling="no"` (deprecated) or `overflow: hidden` on iframes. Users who zoom in or enlarge text need to scroll to reach content that overflows. (1.4.4 Resize Text (Level AA), 1.4.10 Reflow (Level AA))++### Code Example: using the `<title>` and `<iframe>` elements```html<!-- Good: Distinct title and language declaration -->@@ -215,13 +280,21 @@ When the hidden content is focusable (skip links, focus-receiving wrappers), the### Tab order and focusability-- **Logical Tab Order**: Ensure tab order matches visual layouts (top-to-bottom).-- **Use `tabindex` deliberately**: Anything focusable — by keyboard or programmatically — should have an implicit or explicit ARIA role, so don't make every element focusable. When focus is needed, choose `tabindex="0"` to add the element to the tab order or `tabindex="-1"` to make it programmatically focusable only (e.g., a skip-link target).-- **Don't use Positive Tabindex values**: Never use `tabindex="1"` or greater.+- **Provide a logical tab order:** Make sure that the order in which elements receive focus follows an appropriate sequence. (2.4.3 Focus Order (Level A))+ - **Caveat:** In left-to-right reading languages, the tab order is logical when focus moves from top-to-bottom and left-to-right. However, in right-to-left reading languages, the tab order is logical when focus moves from top-to-bottom and right-to-left.+- **Use `tabindex` only when necessary:** Apply `tabindex="0"` to elements requiring focus where an appropriate interactive role has been applied but the element isn't focusable by default; for example, `<span role="button" tabindex="0">Print</span>` (2.4.3 Focus Order (Level A))+- **Manage focus correctly to and from updated content:** For example, if a dialog box appears on the page, make sure that focus immediately moves to the dialog box, is restricted to the contents of the dialog box, and (when dismissed) returns to the element that originally triggered the dialog box. (2.4.3 Focus Order (Level A))+- **Don't apply `tabindex="0"` to interactive elements that are already focusable by default:** Native elements like the `<button>`, `<a>` (only with the associated `href` attribute), and `<input>` elements are already keyboard focusable, and therefore do not require `tabindex="0"`. (2.4.3 Focus Order (Level A))+- **Don't apply `tabindex="0"` to static, non-interactive, and hidden elements:** Only elements that (when activated) perform a specific action should be included in a page's tab order. Static, non-interactive, and hidden elements (whether hidden temporarily or permanently) must not be focusable. (2.4.3 Focus Order (Level A))+- **Mandatory - Don't use positive `tabindex` values:** Never apply `tabindex="1"` (or any value > 0) to elements, as doing so imposes a tab order on the page that bears no resemblance to the intended or expected tab order. (2.4.3 Focus Order (Level A))### Keyboard handlers-- **Custom Trigger Keyboards**: Attach Enter/Space handlers for custom simulated interactive elements. When implementing a custom keyboard handler for button-like elements, `Enter` should be a `keydown` handler and `Space` should be a `keyup` handler (matching native `<button>` behavior where `Enter` repeats and `Space` triggers on release).+- **Attach <kbd>Enter</kbd>/<kbd>Space</kbd> handlers for custom simulated interactive elements:** When implementing a custom keyboard handler for button-like elements, <kbd>Enter</kbd> should be a `keydown` handler and <kbd>Space</kbd> should be a `keyup` handler (matching native `<button>` behavior where <kbd>Enter</kbd> repeats and <kbd>Space</kbd> triggers on release). (2.1.1 Keyboard (Level A))+- **Don't attach keyboard handlers to native interactive elements:** Native elements such as the `<button>`, `<input>`, and `<a>` (with the required `href` attribute) elements already support the <kbd>Enter</kbd> and (except for the `<a>` element) the <kbd>Space</kbd> keys by default, so adding these keyboard handlers is redundant. (Best Practice)+ - **Caveat:** if the `<a>` element is repurposed as a button through the inclusion of `role="button"`, a `keyup` handler is still required to support the <kbd>Space</kbd> key to match native `<button>` behavior.++#### Code Example: Keyboard handlers```javascript// Good: Keyboard handlers for complex custom widgets (e.g., Tree items, tabs).@@ -252,10 +325,13 @@ function toggleWidgetState() {### Focus indicators-- **Visible Focus Indicators**: Always style `:focus-visible` states (not `:focus`) explicitly. If disabling defaults, provide overrides with sufficient contrast.-- **Don't disable outlines without replacements**: Avoid `outline: none` without styling alternatives.-- Prefer `outline` over other properties (e.g. `box-shadow`) for focus rings. If you must rely on `box-shadow` for focus rings, provide an `outline`-based fallback for High Contrast Mode using the `forced-colors` media query.-- Pair focus outlines with `outline-offset` to visually separate the ring from the element.+- **Use `:focus-visible` when styling focus indicators:** When defining custom focus indicators, always style the `:focus-visible` state (not `:focus`) explicitly. (Best Practice)+- **Prefer browser native focus indicators over custom focus indicators:** Leave focus indication to the browser unless custom focus styling is needed to meet contrast or design requirements. (Best Practice)+- **Mandatory - Don't disable browser native focus indicators without providing a replacement custom focus indicator:** When using `outline: none;` to suppress the browser native focus indicator, provide an equivalent custom focus indicator that has a contrast ratio of at least `3:1` against adjacent content (2.4.7 Focus Visible (Level AA), 1.4.11 Non-text Contrast (Level AA)).+- **Prefer `outline` over other properties for focus rings:** If `box-shadow` must be relied on for focus rings, provide an `outline`-based fallback for High Contrast Mode using the `forced-colors` media query. (Best Practice)+- **Pair custom focus outlines with `outline-offset`:** This visually separates the ring from the element. (Best Practice)++#### Code Example: Custom focus indication```css/* Good: High contrast focus border */@@ -265,20 +341,24 @@ function toggleWidgetState() {}```-### Touch targets+### Target sizes-- Interactive elements should be at least 24×24 CSS pixels (WCAG 2.5.8 AA). Enforce with `min-block-size` / `min-inline-size` or padding rather than `width` / `height`, so content can grow the target but not shrink it.-- Bump targets up on coarse pointers: `@media (pointer: coarse) { ... }`.-- **DON'T** use `touch-action: none` for custom gestures — it disables page scrolling through the element. Scope to the axis you actually need: `pan-y` for horizontal swipes (page still scrolls vertically), `pan-x` for vertical ones. Reserve `none` for elements where no native touch behavior makes sense (e.g. a drawing canvas).+- **Do size interactive elements to have a target of at least 24x24 CSS pixels:** Enforce the target size of elements using `min-block-size` / `min-inline-size` or through padding rather than `width` / `height` so that content grows the target but not shrink it. (2.5.8 Target Size (Minimum) (Level AA))+ - **Caveat:** Interactive elements _may_ have a target of less than 24x24 CSS pixels _as long as_ they are positioned in such a way that if a 24 CSS pixel diameter circle is centered on the bounding box of each element, the circles do not intersect nearby targets or circles for other targets that are less than 24x24 CSS pixels.+- **Bump targets up on coarse pointers:** `@media (pointer: coarse) { … }`. (2.5.8 Target Size (Minimum) (Level AA))+- **Don't use `touch-action: none;` for custom gestures:** This disables page scrolling through the element. Scope to the axis you actually need - `pan-y` for horizontal swipes (the page still scrolls vertically), and `pan-x` for vertical swipes. Reserve `none` for elements where no native touch behavior makes sense, such as a drawing canvas. (2.1.1 Keyboard (Level A))## 6. Alternate Text and Media### Images-- **Informative Visual Descriptions**: Describe the purpose of the image (e.g., "Search", not "Magnifying glass").-- **Empty Alt properties for decorative visuals**: Use `alt=""` to remove decorative images from the accessibility tree so they aren't announced.-- **Don't use clichéd prefixes**: Avoid "Image of..." or "Picture of...".-- **Don't use underscores in filenames**: Use dashes if the filename might be announced as fallback.+- **Mandatory - Apply the `alt` attribute to all `<img>` elements:** browsers replace the image with the value of this attribute for people who use screen readers. (1.1.1 Non-text Content (Level A))+- **Do provide informative visual descriptions:** Describe the purpose of the image (for example, "Search", not "Magnifying glass"). (1.1.1 Non-text Content (Level A))+- **Do apply `alt=""` to decorative visuals:** This prevents screen readers from announcing them. (1.1.1 Non-text Content (Level A))+- **Don't use clichéd prefixes:** Avoid terms like "Image of…" and "Picture of…". (Best Practice)+- **Don't use underscores in filenames:** Use dashes if the filename might be announced as fallback. (Best Practice)++#### Code Example: Providing a text description for `<img>` elements```html<!-- Decorative -->@@ -292,11 +372,35 @@ function toggleWidgetState() {### Inline SVGs-- **Informative View Descriptions for inline SVGs**: Apply `role="img"` and a nested `<title>` tag for informative visuals.-- **Decorative SVGs removal**: Apply `aria-hidden="true"` to remove decorative SVGs from reading flows.+- **Do apply `role="img"` to the `<svg>` element for non-decorative SVGs:** This is so that they are globally exposed as images. (4.1.2 Name, Role, Value (Level A))+- **Do provide a text description for non-decorative SVGs:** Use one of the following techniques: (1.1.1 Non-text Content (Level A))+ - Include a nested `<title>` element as a child of the `<svg>` element that includes the text description. **or**+ - Apply the `aria-label` attribute to the `<svg>` element and set its value to an appropriate text description.+- **Do hide decorative SVGs from assistive technologies:** Apply `aria-hidden="true"` to decorative `<svg>` elements to prevent screen readers from announcing them. (1.1.1 Non-text Content (Level A))++#### Code Example: Providing a text description for non-decorative SVGs using the `<title>` element++```html+<!-- Inline non-decorative SVG: example that uses the <title> element -->+<svg role="img" viewBox="0 0 24 24">+ <title>Home</title>+ <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>+</svg>+```++#### Code Example: Providing a text description for non-decorative SVGs using the `aria-label` attribute++```html+<!-- Inline non-decorative SVG: example that uses the aria-label attribute -->+<svg role="img" viewBox="0 0 24 24" aria-label="Home">+ <path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>+</svg>+```++#### Code Example: Identifying decorative SVGs```html-<!-- Inline Decorative SVG (remove from tab flow) -->+<!-- Inline Decorative SVG (hide from assistive technologies) --><svg aria-hidden="true" viewBox="0 0 24 24"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>@@ -304,8 +408,10 @@ function toggleWidgetState() {### Complex images and charts-- **Long descriptions for complex images**: Use `<figure>`/`<figcaption>` or `aria-describedby` for charts and infographics.-- **Provide data tables as alternatives**: Consider providing semantic data tables as accessible alternatives for charts and other complex data visualizations.+- **Provide long descriptions for complex images:** Use `<figure>`/`<figcaption>` or `aria-describedby` for charts and infographics. (1.1.1 Non-text Content (Level A))+- **Provide semantic data tables as alternatives:** Provide semantic data tables as accessible alternatives for charts and other complex visualizations. (1.1.1 Non-text Content (Level A))++#### Code Example: Complex graph with figcaption```html<!-- Complex graph with figcaption -->@@ -317,8 +423,13 @@ function toggleWidgetState() {### Audio and video-- **Synchronous Captions for videos**: Supply WebVTT captions for video tracks.-- **Transcripts for audio**: Provide text transcripts for purely audio podcasts.+- **Mandatory - Provide a transcript for audio-only content and combined video & audio content:** The transcript should be verbatim, and include all of the dialogue as well as text descriptions of important non-speech sounds such as sound effects. (1.2.1 Audio-only and Video-only (Prerecorded) (Level A), 1.2.3 Audio Description or Media Alternative (Prerecorded) (Level AA))+- **Mandatory - Provide a text description or an audio track for video-only content:** Examples include text-based instructions for an animation on how to use a particular product, and a separate audio track that includes a description of the action in the video. (1.2.1 Audio-only and Video-only (Prerecorded) (Level A))+- **Mandatory - Provide synchronous captions for videos:** Supply WebVTT captions for audio tracks within video content. The captions should be verbatim and synchronous with the audio track, and include all of the dialogue as well as meaningful non-speech content such as sound effects and other important information conveyed within the soundtrack (for example, "Ominous music plays"). (1.2.2 Captions (Prerecorded) (Level A))+ - **Caveat:** Captions are not required if the video is a decorative alternative for text that is already present and is clearly identified as such.+- **Do provide an audio description for videos:** Include an additional audio track within the video that augments the visual content displayed on-screen. The audio description should convey information about the scene that is not described or spoken in the main audio track, and should be conveyed during existing pauses in the dialogue. (1.2.3 Audio Description or Media Alternative (Prerecorded) (Level A), 1.2.5 Audio Description (Prerecorded) (Level AA))++#### Code Example: Video and audio content with captions and transcript```html<!-- Video with Captions tracks -->@@ -339,7 +450,7 @@ function toggleWidgetState() {### CSS generated content-- **Alt text for CSS generated content**: Use the alternative text argument of `content` (e.g. `content: url(icon.svg) / "Save";`) and keep meaningful text in the DOM. See `accessible-generated-content` (via `npx -y modern-web-guidance@latest retrieve "accessible-generated-content"`) for more details.+- **Alt text for CSS generated content:** Use the alternative text argument of `content` (e.g. `content: url(icon.svg) / "Save";`) and keep meaningful text in the DOM. See `accessible-generated-content` (via `npx -y modern-web-guidance@latest retrieve "accessible-generated-content"`) for more details. (1.1.1 Non-text Content (Level A))### Content Visibility Decision Matrix@@ -347,18 +458,23 @@ function toggleWidgetState() {| :--- | :--- | :--- | :--- | :--- || **Visible to all** | Yes | Yes | Yes | Standard rendering || **Screen Reader only** | No | Yes | Yes (if interactive) | Visually hidden utility (e.g. `.visually-hidden`) |-| **Visual only** | Yes | No | No | `aria-hidden="true"` / `role="presentation"` |+| **Visual only** | Yes | No | No | `aria-hidden="true"` || **Hidden for all** | No | No | No | `hidden` attribute / `display: none` |-**Heuristic Rule**: If an element can receive keyboard focus, it must not be hidden via `aria-hidden="true"`.+**Heuristic Rule:** If an element can receive keyboard focus, it must not be hidden via `aria-hidden="true"`.++**Note:** only use screen reader only content as a last resort. If content is important, it should be visible for everyone.## 7. Forms and Input Controls### Labels and hints-- **Connect Labels Programmatically**: Use `<label for="id">` linked to `<input id="id">`.-- **Don't use placeholders as labels**: Placeholders are not persistent labels.-- **Link hints to inputs via `aria-describedby`**: Associate help text with inputs, and place the hint above the input so autocomplete popovers don't cover it during editing.+- **Mandatory - Provide a label for all form controls:** Do not rely on the currently selected input or value as a way of labeling the control. (3.3.2 Labels or Instructions (Level A))+- **Connect Labels Programmatically:** Use `<label for="id">` linked to `<input id="id">`. (1.3.1 Info and Relationships (Level A))+- **Don't use placeholders as primary labels:** Placeholders are not persistent labels. Only use placeholders to provide brief hints, such as an example of an appropriate input. (3.3.2 Labels or Instructions (Level A))+- **Link hints to inputs via `aria-describedby`:** Associate help text with inputs, and place the hint above the input so autocomplete popovers don't cover it during editing. (1.3.1 Info and Relationships (Level A))++#### Code Example: A labeled form control with a hint for passwords```html<!-- Good: Semantic forms with hints for passwords -->@@ -371,10 +487,9 @@ function toggleWidgetState() {### Input assistance and validation-- **Use Autocomplete**: Set valid standard `autocomplete` options (e.g., `"email"` or `"given-name"`) for user profiles.-- **Provide form validation constraints**: Use `required` (or `aria-required="true"` only when `required` isn't applicable) to signal mandatory inputs.-- **Don't trigger context shifts on focus changes**: Avoid auto-submitting forms or jumping pages on focus change events alone.-+- **Mandatory - Use the `autocomplete` attribute:** Apply the `autocomplete` attribute to `<input>`, `<textarea>`, and `<select>` elements that explicitly collect personal information about the user, and set it to the correct value (for example `"email"` or `"given-name"`). (1.3.5 Identify Input Purpose (Level AA))+- **Provide form validation constraints:** Use `required` (or `aria-required="true"` only when `required` isn't applicable) to signal mandatory inputs. (4.1.2 Name, Role, Value (Level A))+- **Don't trigger context shifts on focus changes:** Avoid auto-submitting forms or jumping pages on focus change events alone. (3.2.1 On Focus (Level A), 3.2.2 On Input (Level A))## 8. Live Regions@@ -388,12 +503,12 @@ Live regions let assistive tech announce content updates that aren't tied to nav| **Standard**| Toast / Banner | `polite` | Announces at next graceful break | Search results, "Saved" status || **Passive** | Silent text | `off` | Only if user navigates to it | Live character count |-**Heuristic Rule**: Use `assertive` only for critical, time-sensitive updates that require immediate attention or prevent safe continuation (e.g., data loss, session timeouts, or network drops).+**Heuristic Rule:** Use `assertive` only for critical, time-sensitive updates that require immediate attention or prevent safe continuation (e.g., data loss, session timeouts, or network drops).-### When to announce+### When to announce live regions-- **Announce dynamic errors via live regions**: Use `aria-live` or shift focus to error lists.-- **Don't use live regions for interstitial states** like "Loading…" or "Updating…" unless they're meaningfully informative — they usually just create noise.+- **Announce dynamic errors via live regions:** Use `aria-live` or shift focus to error lists (4.1.3 Status Messages (Level AA)).+- **Don't use live regions for interstitial states** like "Loading…" or "Updating…" unless they're meaningfully informative — they usually just create noise. Use the HTML `<progress>` element or the ARIA `progressbar` role for this purpose instead. (Best Practice)```html<!-- Session Timeout Warning with controls -->@@ -405,10 +520,10 @@ Live regions let assistive tech announce content updates that aren't tied to nav### Managing announcements-- **Centralize live regions for non-visible announcements**: A single `polite` region and a single `assertive` region per page (with whatever `aria-atomic` configuration you need) keeps announcements consistent and easier to maintain. Many frameworks ship their own announcer abstraction — use it.-- **Debounce frequently-changing regions**: If a region can update many times per second (e.g. a combobox's result count as the user types), debounce so users aren't spammed.-- **Delay slightly when other announcements may collide**: When the user is typing or focus is being managed, a small delay before announcing keeps live-region updates from overlapping other speech.-- **Don't add live-region updates to inert DOM**: When dialogs open or sections become `inert`, queued or debounced messages can end up unannounced — or announced from DOM the user can't reach. Coordinate live-region updates with dialog/inert state changes.+- **Centralize live regions for non-visible announcements:** A single `polite` region and a single `assertive` region per page (with whatever `aria-atomic` configuration you need) keeps announcements consistent and easier to maintain. Many frameworks ship their own announcer abstraction — use it. (Best Practice)+- **Debounce frequently-changing regions:** If a region can update many times per second (e.g. a combobox's result count as the user types), debounce so users aren't spammed. (Best Practice)+- **Delay slightly when other announcements may collide:** When the user is typing or focus is being managed, a small delay before announcing keeps live-region updates from overlapping other speech. (Best Practice)+- **Don't add live-region updates to inert DOM:** When dialogs open or sections become `inert`, queued or debounced messages will be unannounced — or announced from DOM the user can't reach. Coordinate live-region updates with dialog/inert state changes. (4.1.3 Status Messages (Level AA))## 9. Color@@ -424,14 +539,16 @@ See `motion` (via `npx -y modern-web-guidance@latest retrieve "motion"`).## 12. Modals and Native Dialogs-Modern browsers provide native solutions for creating modal dialogs which avoid the need for focus traps, managing the accessibility of outside content, ensuring the content is on top, and dimming the background content — all of which can be error prone and require heavy JavaScript event tracking to maintain.+Modern browsers provide native solutions for creating modal dialogs which avoid the need for focus traps, managing the accessibility of outside content, ensuring the content is on top, and dimming the background content — all of which are error prone and require heavy JavaScript event tracking to maintain.### Native `<dialog>`-- **Use the Native `<dialog>` Element**: Invoke the dialog using the `.showModal()` method to open it in a modal state. When in a modal state, the browser sets outside content as inert (i.e. the outside content is hidden from the accessibility tree and cannot be interacted with nor be focused).-- **Don't implement focus traps for native modal dialogs**: When a `<dialog>` element is opened in a modal state, browsers set outside content as inert which is sufficient for ensuring only the dialog’s content can be focused.+- **Use the native `<dialog>` element:** Invoke the dialog using the `.showModal()` method to open it in a modal state. When in a modal state, the browser sets outside content as inert (i.e. the outside content is hidden from the accessibility tree and cannot be interacted with nor be focused). (1.3.2 Meaningful Sequence (Level A), 2.4.3 Focus Order (Level A), 4.1.2 Name, Role, Value (Level A))+ - **Note:** it is still possible to navigate to the browser chrome when using the `<dialog>` element.+- **Don't implement focus traps for native modal dialogs:** When a `<dialog>` element is opened in a modal state, browsers set outside content as inert which is sufficient for ensuring only the dialog’s content can be focused. (Best Practice)++#### Code Example: HTML & JavaScript: Native `<dialog>` with standard close events-**HTML & JS: Native `<dialog>` with standard close events**```html<!-- Dialog opens natively with showModal() and locks focus --><button id="open-btn">Open Dialog</button>@@ -451,17 +568,18 @@ Modern browsers provide native solutions for creating modal dialogs which avoid### Custom overlays-- **Use the `inert` Attribute for Custom Overlays**: When `<dialog>` cannot be used (e.g., some non-modal overlays, framework constraints, or layouts where `<dialog>`'s top-layer/positioning behavior conflicts with the design), apply `inert` to outside content to ensure it cannot be interacted with by keyboard, pointer, or assistive technology. This requires structuring elements in such a way that the custom overlay is not a descendant of the element with `inert` set on it.-+- **Use the `inert` attribute for custom overlays:** When `<dialog>` cannot be used (e.g., some non-modal overlays, framework constraints, or layouts where `<dialog>`'s top-layer/positioning behavior conflicts with the design), apply `inert` to outside content to ensure it cannot be interacted with by keyboard, pointer, or assistive technology. This requires structuring elements in such a way that the custom overlay is not a descendant of the element with `inert` set on it. (1.3.2 Meaningful Sequence (Level A), 2.4.3 Focus Order (Level A))+- **Apply `role="dialog"` to the custom overlay:** When applied to the element used as the container for the custom overlay, it ensures that it is exposed as a dialog box to assistive technologies. (4.1.2 Name, Role, Value (Level A))+- **Move focus to the overlay:** Ensure keyboard and screen reader focus moves to the container for the overlay so that people using a screen reader and people using the keyboard alone can start navigating its contents. Don't leave focus in outside content. (1.3.2 Meaningful Sequence (Level A), 2.4.3 Focus Order (Level A))## 13. Testing Validations### Automated checks-- **Run Automated checks via axe-core or Lighthouse audits**: Catch missing alt texts or low contrasts (e.g., via Lighthouse in Chrome DevTools MCP).-- **Don't rely purely on scores**: A 100% score does not guarantee real usability.+- **Run Automated checks via axe-core or Lighthouse audits:** Catch missing alt texts or low contrasts (e.g., via Lighthouse in Chrome DevTools MCP).+- **Don't rely purely on scores:** A 100% score does not guarantee real usability.### Manual testing-- **Validate Sequential Navigations using keyboards alone**: Using only keyboard shortcuts, such as Tab/Shift+Tab, arrow keys, Enter, Space, and Esc, confirm every interactive element is reachable and operable, and that focus never gets stuck.-- **Test on Screen Readers with calibrated browsers**: Rely on standard bindings (e.g., JAWS with Chrome, NVDA with Firefox, Narrator with Edge, VoiceOver with Safari on macOS and iOS, TalkBack with Chrome for Android).+- **Validate Sequential Navigations using keyboards alone:** Using only keyboard shortcuts, such as <kbd>Tab</kbd> / <kbd>Shift</kbd> + <kbd>Tab</kbd>, arrow keys, <kbd>Enter</kbd>, <kbd>Space</kbd>, and <kbd>Esc</kbd>, confirm every interactive element is reachable and operable, and that focus never gets stuck.+- **Test on Screen Readers with calibrated browsers:** Rely on standard bindings (e.g., JAWS with Chrome, NVDA with Firefox, Narrator with Edge, VoiceOver with Safari on macOS and iOS, TalkBack with Chrome for Android).diff --git a/skills/modern-web-guidance/guides/css/atrule-support-conditionals.md b/skills/modern-web-guidance/guides/css/atrule-support-conditionals.mdindex 10b72ed..b368095 100644--- a/skills/modern-web-guidance/guides/css/atrule-support-conditionals.md+++ b/skills/modern-web-guidance/guides/css/atrule-support-conditionals.md@@ -138,7 +138,7 @@ IMPORTANT:## Fallback strategiesBrowser support for at-rule(): Limited availability.-Supported by: Chrome 148 (May 2026), Edge 148 (May 2026), and Firefox 157.+Supported by: Chrome 148 (May 2026), Edge 148 (May 2026), and Firefox 157 (Sep 2026).Unsupported in: Safari.Unless this is within your support target, **ONLY** use `@supports (at-rule())` to detect at-rules for which support is narrower than the `@supports (at-rule())` feature itself.diff --git a/skills/modern-web-guidance/guides/css/css-layout.md b/skills/modern-web-guidance/guides/css/css-layout.mdindex 65cf63f..2a59b95 100644--- a/skills/modern-web-guidance/guides/css/css-layout.md+++ b/skills/modern-web-guidance/guides/css/css-layout.md@@ -216,7 +216,7 @@ Baseline status for Popover: Newly available. It's been Baseline since 2025-01-2Supported by: Chrome 116 (Aug 2023), Edge 116 (Aug 2023), Firefox 125 (Apr 2024), Safari 17 (Sep 2023), and Safari iOS 18.3 (Jan 2025).Browser support for Anchor positioning: Limited availability.-Supported by: Safari 27.+Supported by: Safari 27 (Sep 2026).Unsupported in: Chrome, Edge, and Firefox.**When to use each overlay primitive:**diff --git a/skills/modern-web-guidance/guides/forms/animated-select-picker.md b/skills/modern-web-guidance/guides/forms/animated-select-picker.mdindex 20d3fab..f66fd41 100644--- a/skills/modern-web-guidance/guides/forms/animated-select-picker.md+++ b/skills/modern-web-guidance/guides/forms/animated-select-picker.md@@ -160,7 +160,7 @@ The following example demonstrates a custom select styled with standard page ani### Fallbacks & browser support for Customizable <select>Browser support for Customizable <select>: Limited availability.-Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27.+Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27 (Sep 2026).Unsupported in: Firefox.For browsers that do not yet support `appearance: base-select`, the `<select>` element degrades gracefully to a standard operating system dropdown.diff --git a/skills/modern-web-guidance/guides/forms/autofill-address-form.md b/skills/modern-web-guidance/guides/forms/autofill-address-form.mdindex e44a86f..9050337 100644--- a/skills/modern-web-guidance/guides/forms/autofill-address-form.md+++ b/skills/modern-web-guidance/guides/forms/autofill-address-form.md@@ -58,6 +58,14 @@ Use a single `<textarea>` element for the street address if possible.This is the most flexible option for a variety of local and international address formats.+If your data model needs separate address lines, use one `<input>` per line with the `address-line1`, `address-line2` (and, if needed, `address-line3`) `autocomplete` tokens so that autofill still works. Don't split the street address across inputs that lack these tokens, and make only the first line required.++```html+<!-- Alternative: one input per line, each with its own autocomplete token -->+<input type="text" id="address-line1" name="address-line1" autocomplete="address-line1" required>+<input type="text" id="address-line2" name="address-line2" autocomplete="address-line2">+```+### Help save users from accidentally missing data fieldsAdd the `required` attribute to mandatory fields.@@ -68,8 +76,7 @@ Add the `required` attribute to mandatory fields.### Fallback strategies-Browser support for :autofill: Limited availability.-Supported by: Chrome 110 (Feb 2023), Edge 110 (Feb 2023), and Safari 15 (Sep 2021).-Unsupported in: Firefox.+Baseline status for the html.elements.input.autocomplete capability: Widely available. It's been Baseline since 2015-07-29.+Supported by: Chrome 14 (Sep 2011), Edge 12 (Jul 2015), Firefox 4 (Mar 2011), and Safari 6 (Jul 2012).Autofill is a progressive enhancement. In browsers that do not support autofill, users will simply need to manually enter their address details. The semantic HTML constraints (such as `type`, `inputmode`, and `required`) will still function appropriately as standard form validation.diff --git a/skills/modern-web-guidance/guides/forms/autofill-payment-form.md b/skills/modern-web-guidance/guides/forms/autofill-payment-form.mdindex 1e3b39d..7ba4e34 100644--- a/skills/modern-web-guidance/guides/forms/autofill-payment-form.md+++ b/skills/modern-web-guidance/guides/forms/autofill-payment-form.md@@ -98,6 +98,16 @@ Make sure to add appropriate `autocomplete` values in payment card forms. Withouinputmode="numeric" maxlength="4" pattern="[0-9]{3,4}" required>```+### Show format hints above the input++Where a field has a required format (for example the `MM/YY` expiry date), put the hint in a visible element **above** the input and link the two with `aria-describedby`, as in the `cc-exp` example above. Hints that sit below an input are easily hidden by the mobile keyboard or by the autofill popover at the moment the user needs them.++Don't rely on the `placeholder` attribute as the only format hint, and never use it instead of a `<label>`: placeholder text is hidden as soon as the user starts typing, so it can't be checked against while editing. A placeholder is fine as an extra cue alongside the label and the persistent hint.++### Don't mask the security code++Use `type="text"` with `inputmode="numeric"` for the card security code, not `type="password"`. Users can't check a masked three- or four-digit code for typos, so a mistyped digit isn't caught until the payment is declined, and masking adds little protection because the code is printed on the card the user is holding.+### Use a single input for payment card and phone numbersFor payment card and phone numbers use a single input: don't split the number into parts. That makes it easier for users to enter data, makes validation simpler, and enables browsers to autofill. Consider doing the same for other numeric data such as PIN and bank codes.diff --git a/skills/modern-web-guidance/guides/forms/autofill-sign-in-form.md b/skills/modern-web-guidance/guides/forms/autofill-sign-in-form.mdindex 636555b..2acf442 100644--- a/skills/modern-web-guidance/guides/forms/autofill-sign-in-form.md+++ b/skills/modern-web-guidance/guides/forms/autofill-sign-in-form.md@@ -94,11 +94,11 @@ You can help browsers store data correctly and autofill inputs, so users don't h1. The `autocomplete`, `name`, `id`, and `type` attributes help browsers understand the role of inputs in order to store data that can later be used for autofill. To allow data to be stored for autofill, modern browsers also require inputs to have a stable `name` or `id` value (not randomly generated on each page load or site deployment), and to be in a `<form>` element with a `submit` button.1. The `autocomplete` attribute helps browsers correctly autofill inputs using stored data.-For email inputs use `autocomplete="username"`, since `username` is recognized by password managers in modern browsers—even though you should use `type="email"` and you may want to use `id="email"` and `name="email"`. For password inputs, use the appropriate `autocomplete` and `id` values to help browsers differentiate between new and current passwords.+For email inputs use `autocomplete="username"`, since `username` is recognized by password managers in modern browsers—even though you should use `type="email"` and you may want to use `id="email"` and `name="email"`. For password inputs, use the appropriate `autocomplete` value to help browsers differentiate between new and current passwords.-### Use autocomplete="current-password" and id="current-password" for an existing password+### Use autocomplete="current-password" for an existing password-MANDATORY: Use `autocomplete="current-password"` and `id="current-password"` for the password input in a sign-in form. This tells the browser that you want it to use the current password that it has stored for the site.+MANDATORY: Use `autocomplete="current-password"` for the password input in a sign-in form. This tells the browser that you want it to use the current password that it has stored for the site.For a sign-in form:@@ -136,6 +136,6 @@ Baseline status for inputmode: Widely available. It's been Baseline since 2021-1Supported by: Chrome 66 (Apr 2018), Edge 79 (Jan 2020), Firefox 95 (Dec 2021), Safari 12.1 (Mar 2019), and Safari iOS 12.2 (Mar 2019).Baseline status for autocorrect: Newly available. It's been Baseline since 2026-09-11.-Supported by: Chrome 153, Edge 153 (Sep 2026), Firefox 136 (Mar 2025), Safari 14.1 (Apr 2021), and Safari iOS 14.5 (Apr 2021).+Supported by: Chrome 153 (Sep 2026), Edge 153 (Sep 2026), Firefox 136 (Mar 2025), Safari 14.1 (Apr 2021), and Safari iOS 14.5 (Apr 2021).Autofill is a progressive enhancement. In browsers that do not support autofill, users will simply need to manually enter their sign-in credentials. The semantic HTML constraints (such as `type`, `inputmode`, and `required`) will still function appropriately to validate user input and provide the correct virtual keyboards.diff --git a/skills/modern-web-guidance/guides/forms/autofill-sign-up-form.md b/skills/modern-web-guidance/guides/forms/autofill-sign-up-form.mdindex 0dcf5ee..251fbac 100644--- a/skills/modern-web-guidance/guides/forms/autofill-sign-up-form.md+++ b/skills/modern-web-guidance/guides/forms/autofill-sign-up-form.md@@ -94,9 +94,9 @@ You can help browsers store data correctly and autofill inputs, so users don't h1. The `autocomplete`, `name`, `id`, and `type` attributes help browsers understand the role of inputs in order to store data that can later be used for autofill. To allow data to be stored for autofill, modern browsers also require inputs to have a stable `name` or `id` value (not randomly generated on each page load or site deployment), and to be in a `<form>` element with a `submit` button.1. The `autocomplete` attribute helps browsers correctly autofill inputs using stored data.-For email inputs use `autocomplete="username"`, since `username` is recognized by password managers in modern browsers—even though you should use `type="email"` and you may want to use `id="email"` and `name="email"`. For password inputs, use the appropriate `autocomplete` and `id` values to help browsers differentiate between new and current passwords.+For email inputs use `autocomplete="username"`, since `username` is recognized by password managers in modern browsers—even though you should use `type="email"` and you may want to use `id="email"` and `name="email"`. For password inputs, use the appropriate `autocomplete` value to help browsers differentiate between new and current passwords.-### Use autocomplete="new-password" and id="new-password" for a new password+### Use autocomplete="new-password" for a new passwordMANDATORY: For a sign-up form, use `autocomplete="new-password"`.@@ -146,6 +146,6 @@ Baseline status for inputmode: Widely available. It's been Baseline since 2021-1Supported by: Chrome 66 (Apr 2018), Edge 79 (Jan 2020), Firefox 95 (Dec 2021), Safari 12.1 (Mar 2019), and Safari iOS 12.2 (Mar 2019).Baseline status for autocorrect: Newly available. It's been Baseline since 2026-09-11.-Supported by: Chrome 153, Edge 153 (Sep 2026), Firefox 136 (Mar 2025), Safari 14.1 (Apr 2021), and Safari iOS 14.5 (Apr 2021).+Supported by: Chrome 153 (Sep 2026), Edge 153 (Sep 2026), Firefox 136 (Mar 2025), Safari 14.1 (Apr 2021), and Safari iOS 14.5 (Apr 2021).Autofill is a progressive enhancement. In browsers that do not support autofill, users will simply need to manually enter their sign-up credentials. The semantic HTML constraints (such as `type`, `inputmode`, and `required`) will still function appropriately to validate user input and provide the correct virtual keyboards.diff --git a/skills/modern-web-guidance/guides/forms/branded-select-styling.md b/skills/modern-web-guidance/guides/forms/branded-select-styling.mdindex 0e92980..52be5a7 100644--- a/skills/modern-web-guidance/guides/forms/branded-select-styling.md+++ b/skills/modern-web-guidance/guides/forms/branded-select-styling.md@@ -96,7 +96,7 @@ The following example demonstrates a custom select styled with a monospace font### Fallbacks & browser support for Customizable <select>Browser support for Customizable <select>: Limited availability.-Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27.+Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27 (Sep 2026).Unsupported in: Firefox.For browsers that do not yet support `appearance: base-select`, the `<select>` element degrades gracefully to a standard operating system dropdown.diff --git a/skills/modern-web-guidance/guides/forms/custom-select-picker-layouts.md b/skills/modern-web-guidance/guides/forms/custom-select-picker-layouts.mdindex 533bb0a..65cb46c 100644--- a/skills/modern-web-guidance/guides/forms/custom-select-picker-layouts.md+++ b/skills/modern-web-guidance/guides/forms/custom-select-picker-layouts.md@@ -147,7 +147,7 @@ Otherwise, it may be ultimately necessary to switch to a custom solution using t### Fallbacks & browser support for Customizable <select>Browser support for Customizable <select>: Limited availability.-Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27.+Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27 (Sep 2026).Unsupported in: Firefox.For browsers that do not yet support `appearance: base-select`, the `<select>` element degrades gracefully to a standard operating system dropdown.diff --git a/skills/modern-web-guidance/guides/forms/rich-media-picker.md b/skills/modern-web-guidance/guides/forms/rich-media-picker.mdindex 1a09518..63c51f3 100644--- a/skills/modern-web-guidance/guides/forms/rich-media-picker.md+++ b/skills/modern-web-guidance/guides/forms/rich-media-picker.md@@ -114,7 +114,7 @@ select.custom-select option:checked .option-title {### Fallbacks & browser support for Customizable <select>Browser support for Customizable <select>: Limited availability.-Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27.+Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), and Safari 27 (Sep 2026).Unsupported in: Firefox.For browsers that do not yet support `appearance: base-select`, the `<select>` element degrades gracefully to a standard operating system dropdown.diff --git a/skills/modern-web-guidance/guides/forms/sms-otp-form.md b/skills/modern-web-guidance/guides/forms/sms-otp-form.mdindex ce745b2..284286f 100644--- a/skills/modern-web-guidance/guides/forms/sms-otp-form.md+++ b/skills/modern-web-guidance/guides/forms/sms-otp-form.md@@ -180,7 +180,7 @@ Inside the `<iframe>` document served by `https://bank.example`, run the same `<### WebOTP API fallbackBrowser support for WebOTP: Limited availability.-Supported by: Chrome 93 (Aug 2021), Edge 93 (Sep 2021), and Safari 27.+Supported by: Chrome 93 (Aug 2021), Edge 93 (Sep 2021), and Safari 27 (Sep 2026).Unsupported in: Firefox.If your target browsers do not support the WebOTP API (`OTPCredential`), do not load a third-party JavaScript polyfill, as reading incoming SMS messages requires operating-system-level integration. Instead, rely on the three-tier progressive enhancement built into the `<input>` markup:diff --git a/skills/modern-web-guidance/guides/js/calculate-event-differentials.md b/skills/modern-web-guidance/guides/js/calculate-event-differentials.mdindex b8f0841..f40a7c3 100644--- a/skills/modern-web-guidance/guides/js/calculate-event-differentials.md+++ b/skills/modern-web-guidance/guides/js/calculate-event-differentials.md@@ -1,68 +1,89 @@-# Calculating Event Differentials with Temporal+# Calculating Event Differentials and Formatting Durations with Temporal-Calculating the time elapsed between events (such as trial expirations, subscription durations, or prorated costs) has historically been difficult with the legacy `Date` object due to complexities with time zones, daylight saving time (DST), and inconsistent parsing.+Calculating the time elapsed or remaining between events (such as trial expirations, subscription countdowns, or SLA windows) and presenting those spans in a localized, human-readable format has historically required manual math or external libraries. The legacy `Date` object only tracks epoch milliseconds, making calendar-month arithmetic, Daylight Saving Time (DST) transitions, and unit balancing error-prone.-The `Temporal` API provides a modern, robust solution for date and time arithmetic. Specifically, `Temporal.ZonedDateTime` and `Temporal.Duration` enable exact, DST-safe calculations of time differences.+The `Temporal` API pairs `Temporal.ZonedDateTime` with `Temporal.Duration` and `Intl.DurationFormat` to provide DST-safe time differentials, configurable unit balancing, calendar-aware duration comparisons, and localized formatting.## How to Implement-To calculate differentials between two events:+1. **Obtain `Temporal.ZonedDateTime` endpoints**: Use `Temporal.Now.zonedDateTimeISO()` for the current time in the system time zone, or pass an explicit IANA time zone string—`Temporal.Now.zonedDateTimeISO(timeZone)`—when the target event's time zone differs from the user's system default.+2. **Calculate differentials with `.since()` and `.until()`**:+ - Use `now.since(start, options)` to compute time elapsed since a past event.+ - Use `now.until(end, options)` to compute time remaining until a future event.+ - Pass `largestUnit` (e.g., `'year'`, `'month'`, `'day'`, `'hour'`) and `smallestUnit` (e.g., `'minute'`) to balance and round the resulting `Temporal.Duration`.+3. **Balance or compare standalone `Temporal.Duration` objects**:+ - Create standalone durations with `Temporal.Duration.from({ minutes: 90 })` and rebalance units with `duration.round({ largestUnit: 'hour' })` (supplying `relativeTo` when balancing across calendar months, years, or DST transitions).+ - Compare two durations with `Temporal.Duration.compare(d1, d2, { relativeTo })`—passing a `PlainDate` or `ZonedDateTime` as `relativeTo` is required whenever either duration contains calendar units (`years`, `months`, `weeks`) or crosses DST boundaries.+4. **Format for humans vs. machines**:+ - Use `duration.toLocaleString(locale, options)` (which delegates to `Intl.DurationFormat`) for localized user-facing text.+ - Use `duration.toString()` only for machine-readable ISO 8601 duration strings (such as `P1M2DT4H`).-1. **Obtain ZonedDateTime objects**: Convert your inputs (dates and times) into `Temporal.ZonedDateTime` objects. This ensures calculations are time-zone aware.-2. **Calculate active time with `.since()`**: Use `currentZonedDateTime.since(startZonedDateTime)` to find the time elapsed since a start event.-3. **Calculate remaining time with `.until()`**: Use `currentZonedDateTime.until(endZonedDateTime)` to find the time remaining until a future event.-4. **Control precision with options**: Use `largestUnit`, `smallestUnit`, and `roundingMode` to control how the resulting duration is balanced and rounded.--### Example: Trial Expiration Calculation+### Example: Trial Expiration Differential and Localized Formatting```javascript-// 1. Get current time point in the system time zone-const now = Temporal.Now.zonedDateTimeISO();-const tz = now.timeZoneId;+// 1. Get the current time in an explicit target IANA time zone (or omit the+// argument to use the system's current time zone).+const tz = 'America/New_York';+const now = Temporal.Now.zonedDateTimeISO(tz);// 2. Combine separate date and time strings directly.-// Do not build an ISO string with template literals; chain the Temporal methods instead.-const startDateStr = "2025-01-01";-const startTimeStr = "12:00:00";-const endDateStr = "2025-01-31";-const endTimeStr = "12:00:00";+// Do not build an ISO string with template literals; chain Temporal methods instead.+const startDateStr = '2025-01-01';+const startTimeStr = '12:00:00';+const endDateStr = '2025-01-31';+const endTimeStr = '12:00:00';const start = Temporal.PlainDate.from(startDateStr).toPlainDateTime(startTimeStr).toZonedDateTime(tz);const end = Temporal.PlainDate.from(endDateStr).toPlainDateTime(endTimeStr).toZonedDateTime(tz);-// 3. Calculate difference using .since() and .until()+// 3. Calculate differences using .since() and .until()// ZonedDateTime differences default to largestUnit: 'hour' (days are not a fixed// length across DST, so Temporal won't balance into days unless asked). Pass// largestUnit: 'day' or a calendar unit ('week', 'month', 'year') when you want a-// human-scale breakdown instead of e.g. PT1763H. smallestUnit rounds away+// human-scale breakdown instead of e.g. PT720H. smallestUnit rounds away// seconds and sub-second noise so the formatted string stays readable.const timeActive = now.since(start, { largestUnit: 'year', smallestUnit: 'minute' });const timeRemaining = now.until(end, { largestUnit: 'year', smallestUnit: 'minute' });-// Format durations for display with .toLocaleString() (Intl.DurationFormat)+// 4. Format durations for display with .toLocaleString() (Intl.DurationFormat)// instead of manually concatenating unit numbers and suffixes. 'en-US' is used// here for deterministic output; pass undefined to use the user's locale.console.log(`Active: ${timeActive.toLocaleString('en-US', { style: 'narrow' })}`);-console.log(`Remaining: ${timeRemaining.toLocaleString('en-US', { style: 'narrow' })}`);+console.log(`Remaining: ${timeRemaining.toLocaleString('en-US', { style: 'long' })}`);++// Use .toString() for ISO 8601 serialization (e.g., API payloads or <time datetime="...">)+console.log(`ISO 8601: ${timeRemaining.toString()}`);-// 4. Check status by leveraging the native .sign property on computed Duration objects+// 5. Check status via .sign, and compare durations with Temporal.Duration.compare()const isExpired = timeRemaining.sign < 0;-if (isExpired) {- console.log("Subscription is expired.");-}+// Pass relativeTo when comparing durations that may include calendar months/years or DST shifts+const isPastHalfway = Temporal.Duration.compare(timeActive, timeRemaining, { relativeTo: now }) > 0;+```++### Example: Balancing Standalone Durations (`round` and `Intl.DurationFormat`)++```javascript+// Convert a raw unit count (e.g., 90 minutes) into a balanced breakdown (1 hour, 30 minutes)+const rawDuration = Temporal.Duration.from({ minutes: 90 });+const balanced = rawDuration.round({ largestUnit: 'hour' });++// Format via duration.toLocaleString() or directly with Intl.DurationFormat+const formatter = new Intl.DurationFormat('en-US', { style: 'long' });+console.log(formatter.format(balanced)); // "1 hour, 30 minutes"```## Strategic Implementation & Best Practices-- **DO** use `Temporal.ZonedDateTime` for calculations involving real-world events that occur in specific time zones (like subscription renewals or event scheduling).-- **DO** combine separate date and time strings with Temporal methods, e.g. `Temporal.PlainDate.from(dateStr).toPlainDateTime(timeStr).toZonedDateTime(tz)` or `Temporal.PlainDate.from(dateStr).toZonedDateTime({ timeZone: tz, plainTime: timeStr })`, instead of interpolating an ISO string like `` `${dateStr}T${timeStr}` ``.-- **DO** pass `largestUnit` (e.g. `'day'`, `'month'`, `'year'`) when you want durations balanced beyond hours; `ZonedDateTime` difference methods default to `'hour'`.-- **DO** use `.since()` when calculating time elapsed *since* a past event (e.g., `now.since(start)`), and `.until()` for time remaining *until* a future event (e.g., `now.until(end)`).-- **DO** format durations for display using `.toLocaleString()` (e.g., `duration.toLocaleString(undefined, { style: 'narrow' })` or `{ style: 'digital' }`), which uses `Intl.DurationFormat` under the hood, instead of manually concatenating unit numbers and suffixes.-- **DO** render a `PlainTime` as `HH:MM` (e.g., for `<input type="time">`) using `.toPlainTime().toString({ smallestUnit: 'minute' })` rather than string `.slice(0, 5)`.-- **DO NOT** modify instances directly; `Temporal` objects are **immutable**. Operations like `add()`, `subtract()`, or `with()` return a *new* instance.-- **DO NOT** fall back to `Date`/`getTime()` arithmetic for the differential itself; `Date` has no time-zone-aware calendar math and only millisecond precision.-- **DO** use the native `.sign` property of the computed `Temporal.Duration` (or use `Temporal.ZonedDateTime.compare`) to check if a duration represents a past/expired time point (negative sign) or future pending start.+- **DO** use `Temporal.ZonedDateTime` for calculations involving real-world events that occur in specific time zones (like subscription renewals or event countdowns), and pass an explicit `timeZone` to `Temporal.Now.zonedDateTimeISO(timeZone)` when calculating against a zone other than the system default.+- **DO** combine separate date and time strings with Temporal methods, e.g. `Temporal.PlainDate.from(dateStr).toPlainDateTime(timeStr).toZonedDateTime(tz)` or `Temporal.PlainDate.from(dateStr).toZonedDateTime({ timeZone: tz, plainTime: timeStr })`, instead of interpolating an ISO string like `` `${dateStr}T${timeStr}` ``.+- **DO** pass `largestUnit` (e.g. `'day'`, `'month'`, `'year'`) in `.since()`, `.until()`, or `.round()` when you want durations balanced beyond hours; `ZonedDateTime` difference methods default to `'hour'`.+- **DO** use `Temporal.Duration.compare(d1, d2, { relativeTo })` when comparing two durations, providing a `relativeTo` anchor whenever either duration involves calendar units (`months`, `years`) or time-zone-aware days.+- **DO** format durations for user display using `duration.toLocaleString()` or `new Intl.DurationFormat(locale, { style })` (`'long'`, `'short'`, `'narrow'`, or `'digital'`) instead of manually interpolating `${duration.years}y ${duration.months}m...`.+- **DO** use `duration.toString()` for machine-readable ISO 8601 duration strings (e.g., `PT1H30M`), never as user-facing copy.+- **DO** render a `PlainTime` as `HH:MM` (e.g., for `<input type="time">`) using `.toPlainTime().toString({ smallestUnit: 'minute' })` rather than string `.slice(0, 5)`.+- **DO NOT** modify instances directly; `Temporal` objects are **immutable**. Operations like `.add()`, `.subtract()`, `.round()`, or `.with()` return a *new* instance.+- **DO NOT** fall back to `Date` / `.getTime()` arithmetic for the differential itself; `Date` has no time-zone-aware calendar math and only millisecond precision.+- **DO** use the native `.sign` property of the computed `Temporal.Duration` (or `Temporal.ZonedDateTime.compare()`) to check if a duration represents a past/expired time point (`sign < 0`) or a future pending start.## Fallback Strategy@@ -72,20 +93,25 @@ Browser support for Temporal: Limited availability.Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).Unsupported in: Safari.-For browsers that do not yet support the native `Temporal` API, use feature detection and a polyfill. The standard reference polyfill is `@js-temporal/polyfill`.+For browsers that do not yet support the native `Temporal` API, use feature detection and dynamically load `temporal-polyfill` (~15 KB min+gz).-Note that the polyfill does not automatically assign the `Temporal` object to the global scope to avoid conflicts. You must manually assign it if your code relies on the global `Temporal` object.+Note that importing `temporal-polyfill` does not automatically assign the `Temporal` object to the global scope. Assign it explicitly if your code relies on `globalThis.Temporal`.```javascript// Check if Temporal is supported natively(async () => {if (typeof Temporal === 'undefined') {// Load the polyfill conditionally- const module = await import("https://esm.sh/@js-temporal/polyfill");+ const module = await import('https://esm.sh/temporal-polyfill');globalThis.Temporal = module.Temporal;// Extend Date.prototype if neededDate.prototype.toTemporalInstant = module.toTemporalInstant;- initializeApp();}+ initializeApp();})();-```\ No newline at end of file+```++### Intl.DurationFormat++Baseline status for Intl.DurationFormat: Newly available. It's been Baseline since 2025-03-04.+Supported by: Chrome 129 (Sep 2024), Edge 129 (Sep 2024), Firefox 136 (Mar 2025), and Safari 16.4 (Mar 2023).diff --git a/skills/modern-web-guidance/guides/js/capture-location-agnostic-data.md b/skills/modern-web-guidance/guides/js/capture-location-agnostic-data.mdindex d195d74..98cb37c 100644--- a/skills/modern-web-guidance/guides/js/capture-location-agnostic-data.md+++ b/skills/modern-web-guidance/guides/js/capture-location-agnostic-data.md@@ -1,44 +1,102 @@-# Capturing Location-Agnostic Data with Temporal+# Capturing Location-Agnostic Data and Partial Dates with Temporal-Recording chronological data that should remain identical regardless of the viewer's location (such as birthdates, recurring alarms, or national holidays) has historically been error-prone with the legacy `Date` object. Because a `Date` always represents a specific instant in time and is displayed using whatever time zone the viewer's device happens to be in, saving a date like "1990-01-01" can result in users in different time zones seeing "1989-12-31" due to offset shifts.+Recording chronological data that should remain identical regardless of the viewer's location—such as birthdates, daily alarms, credit card expirations, or monthly billing cycles—has historically been error-prone with the legacy `Date` object. Because a `Date` always represents a specific instant in time and is displayed using the viewer's local time zone, saving a date like `"1990-01-01"` can result in users west of UTC seeing `"1989-12-31"`, while modeling partial dates (like a month-only card expiry) forces arbitrary placeholder days that cause overflow bugs.-The `Temporal` API introduces "Plain" types—such as `Temporal.PlainDate` and `Temporal.PlainTime`—which have no concept of a time zone. These types represent calendar dates and wall-clock times exactly as you would read them off a calendar or a clock, making them ideal for location-agnostic data.+The `Temporal` API provides a family of location-agnostic **"Plain" types** that carry no time zone offset and represent calendar dates and wall-clock times exactly as read off a calendar or clock:-## How to Implement+| Type | What It Models | Typical Use Cases |+|---|---|---|+| `Temporal.PlainDate` | Full calendar date (`year`, `month`, `day`) | Birthdates, event dates, subscription billing dates |+| `Temporal.PlainTime` | Wall-clock time (`hour`, `minute`, `second`, ...) | Daily alarms (9:00 AM wherever the user is), store hours |+| `Temporal.PlainDateTime` | Calendar date + wall-clock time without a time zone | Floating local schedules, combining a `PlainDate` and `PlainTime` before attaching a zone |+| `Temporal.PlainMonthDay` | Month and day without a year | Recurring annual birthdays, anniversaries, fixed holidays |+| `Temporal.PlainYearMonth` | Year and month without a day | Credit card expirations (`2027-12`), monthly billing periods |-To capture and display location-agnostic data:+## How to Implement-1. **Use `Temporal.PlainDate` for dates**: For data like birthdates or holidays, use `Temporal.PlainDate.from()` to create an instance from an ISO 8601 string or an object.-2. **Use `Temporal.PlainTime` for times**: For data like a daily alarm or a preferred lunch time, use `Temporal.PlainTime.from()`.-3. **Display without conversion**: Since these objects are time-zone unaware, they will display the same values regardless of the user's local time zone.+1. **Choose the narrowest `Temporal.Plain*` type that matches your data**:+ - Use `Temporal.PlainDate.from()` for full calendar dates and `Temporal.PlainTime.from()` for wall-clock times.+ - Use `Temporal.PlainDateTime.from()` (or `plainDate.toPlainDateTime(plainTime)`) when combining a calendar date and wall-clock time without binding to a time zone.+ - Use `Temporal.PlainMonthDay.from()` for annual dates without a year, and convert to a `PlainDate` with `.toPlainDate({ year })` before performing date arithmetic.+ - Use `Temporal.PlainYearMonth.from()` for year-and-month values so arbitrary day numbers never leak into calculations.+2. **Note the `calendar` parameter when constructing Plain types**: ISO 8601 (`'iso8601'`) is the default calendar when parsing ISO strings or constructing with `PlainDate.from({ year, month, day })`. When constructing `PlainMonthDay` or `PlainYearMonth` from property bags—or when working with non-ISO calendars—pass `calendar` explicitly (e.g., `{ month: 10, day: 31, calendar: 'iso8601' }`).+3. **Use `.add()` with `overflow` options for recurring calendar intervals**: Calling `plainDate.add({ months: 1 })` defaults to `{ overflow: 'constrain' }`, clamping month-end dates like Jan 31 to Feb 28/29. Pass `{ overflow: 'reject' }` when invalid target dates should throw a `RangeError` instead of clamping.-### Example: Capturing a Birthdate+### Example: Full Dates, Wall-Clock Times, and `PlainDateTime````javascript-// 1. Parse a date string from an input (e.g., "1990-01-01")-const birthdateStr = "1990-01-01";-const plainDate = Temporal.PlainDate.from(birthdateStr);+// 1. Parse a calendar date and a wall-clock time from input strings+const birthdate = Temporal.PlainDate.from('1990-01-01');+const reminderTime = Temporal.PlainTime.from('09:00');++// Combine into a location-agnostic PlainDateTime without string interpolation+const localAppointment = birthdate.toPlainDateTime(reminderTime);-// 2. Display the date-// This will output "01/01/1990" (or equivalent) in any time zone-console.log(plainDate.toLocaleString('en-GB'));+// 2. Display without time zone conversion; outputs the same date in any time zone+console.log(birthdate.toLocaleString('en-GB'));+console.log(localAppointment.toString()); // "1990-01-01T09:00:00"// 3. Read calendar fields directly from the Plain type. A PlainDate already *is*// a calendar date, so there is no need for the formatToParts() workaround that// legacy Date code uses to recover year/month/day from an instant.-const { year, month, day } = plainDate;+const { year, month, day } = birthdate;+```++### Example: Partial Dates (`PlainMonthDay` and `PlainYearMonth`)++```javascript+// Annual recurring event (no year component)+// Include explicit calendar when constructing from an object+const annualHoliday = Temporal.PlainMonthDay.from({+ month: 10,+ day: 31,+ calendar: 'iso8601',+});++const today = Temporal.Now.plainDateISO();+const isToday = annualHoliday.equals(today.toPlainMonthDay());++// Convert PlainMonthDay to a PlainDate with a specific year before doing arithmetic,+// because month lengths (such as February) depend on whether the year is a leap year.+const occurrenceThisYear = annualHoliday.toPlainDate({ year: today.year });++// Monthly expiration (no day component, preventing day-of-month overflow bugs)+const cardExpiry = Temporal.PlainYearMonth.from({+ year: 2027,+ month: 12,+ calendar: 'iso8601',+});+const currentMonth = today.toPlainYearMonth();+const isExpired = Temporal.PlainYearMonth.compare(cardExpiry, currentMonth) < 0;+```++### Example: Recurring Monthly Intervals (`overflow: 'constrain'` vs `'reject'`)++```javascript+const billingStart = Temporal.PlainDate.from('2024-01-31');++// Default overflow: 'constrain' clamps Jan 31 + 1 month to the last valid day of February+const nextBilling = billingStart.add({ months: 1 }, { overflow: 'constrain' });+console.log(nextBilling.toString()); // "2024-02-29" (2024 is a leap year)++// Use overflow: 'reject' to throw a RangeError when the target day does not exist+try {+ billingStart.add({ months: 1 }, { overflow: 'reject' });+} catch (err) {+ // RangeError: day 31 does not exist in February+}```-### Example: Interoperating with legacy `Date`+### Example: Interoperating with Legacy `Date`-A legacy `Date` is a timestamp (an instant), not a calendar date. Storing "1990-01-01" as a `Date` forces you to pick *some* instant (typically midnight UTC), and reading it back in a time zone west of UTC yields "31/12/1989". If a library or API still requires a `Date`, convert explicitly through `Temporal.Instant` rather than building ISO strings by hand:+A legacy `Date` is a timestamp (an instant), not a calendar date. Storing `"1990-01-01"` as a `Date` forces you to pick *some* instant (typically midnight UTC), and reading it back in a time zone west of UTC yields `"31/12/1989"`. If a library or API still requires a `Date`, convert explicitly through `Temporal.Instant` rather than building ISO strings by hand:```javascript// PlainDate -> Date: attach a time zone (time of day defaults to the start of// that day) to get an Instant, then hand the epoch milliseconds to Date.// 'UTC' is a deliberate choice and must be documented; any zone would do,// but the stored instant depends on it.-const instant = plainDate.toZonedDateTime('UTC').toInstant();+const instant = birthdate.toZonedDateTime('UTC').toInstant();const legacyDate = new Date(instant.epochMilliseconds);// Date -> PlainDate: go back through Instant (legacyDate.toTemporalInstant()@@ -49,18 +107,20 @@ const viewedDate = Temporal.Instant.fromEpochMilliseconds(legacyDate.getTime()).toPlainDate();// Compare Plain types with .equals() (or Temporal.PlainDate.compare), not strings.-console.log(viewedDate.equals(plainDate)); // false: the calendar date drifted to 1989-12-31+console.log(viewedDate.equals(birthdate)); // false: the calendar date drifted to 1989-12-31```## Strategic Implementation & Best Practices-- **DO** use `Temporal.PlainDate` for "calendar dates" like birthdates, anniversaries, and holidays where the specific time of day or time zone is irrelevant.-- **DO** use `Temporal.PlainTime` for "wall-clock times" like a daily reminder at 9:00 AM, where the time should be 9:00 AM in whatever time zone the user happens to be in.-- **DO NOT** use Plain types if you need to represent a specific moment in physical time (an "instant"). Use `Temporal.Instant` or `Temporal.ZonedDateTime` for logs, event timestamps, or anything requiring time zone awareness.-- **DO NOT** construct `Date` objects from hand-built ISO strings (such as `` `${date}T00:00:00Z` ``). Produce a `Date` from the `epochMilliseconds` of a `Temporal.Instant` or `Temporal.ZonedDateTime`, and read one back with `Temporal.Instant.fromEpochMilliseconds(date.getTime())` or `date.toTemporalInstant()`, so the time zone assumption is explicit.-- **DO NOT** use `Intl.DateTimeFormat.prototype.formatToParts()` to extract or compare year, month, or day values. Read the `.year`, `.month`, and `.day` properties of a Plain type, and compare with `.equals()`.-- **DO** identify time zones by IANA name (e.g., `America/New_York`) and never by a fixed UTC offset. Offsets change with daylight saving time and legislation, so labels like "UTC-5" become wrong for part of the year.-- **DO** remember that `Temporal` objects are **immutable**. Methods like `add()` or `with()` return a new instance rather than modifying the original.+- **DO** use `Temporal.PlainDate` for full calendar dates, `Temporal.PlainTime` for wall-clock times, `Temporal.PlainDateTime` for local date-time pairs without a zone, `Temporal.PlainMonthDay` for recurring annual dates, and `Temporal.PlainYearMonth` for year-month expirations or billing periods.+- **DO NOT** perform arithmetic directly on `Temporal.PlainMonthDay`; convert it to a `Temporal.PlainDate` first via `.toPlainDate({ year })` because month lengths vary by year.+- **DO** use `.add()` on `Temporal.PlainDate` for recurring calendar intervals, relying on `overflow: 'constrain'` (the default) to clamp month-end dates or `overflow: 'reject'` to throw a `RangeError` on nonexistent dates.+- **DO** specify `calendar` (e.g., `calendar: 'iso8601'`) when constructing `PlainMonthDay` or non-ISO Plain types from objects.+- **DO NOT** use Plain types if you need to represent a specific moment in physical time (an instant). Use `Temporal.Instant` or `Temporal.ZonedDateTime` for logs, event timestamps, or cross-timezone scheduling.+- **DO NOT** construct `Date` objects from hand-built ISO strings (such as `` `${date}T00:00:00Z` ``). Produce a `Date` from the `epochMilliseconds` of a `Temporal.Instant` or `Temporal.ZonedDateTime`, and read one back with `Temporal.Instant.fromEpochMilliseconds(date.getTime())` or `date.toTemporalInstant()`, so the time zone assumption is explicit.+- **DO NOT** use `Intl.DateTimeFormat.prototype.formatToParts()` to extract or compare year, month, or day values. Read `.year`, `.month`, and `.day` directly from a Plain type, and compare with `.equals()`.+- **DO** identify time zones by IANA name (e.g., `America/New_York`) and never by a fixed UTC offset. Offsets change with daylight saving time and legislation, so labels like `"UTC-5"` become wrong for part of the year.+- **DO** remember that `Temporal` objects are **immutable**. Methods like `.add()`, `.subtract()`, or `.with()` always return a new instance with a new reference rather than mutating the original object in place, making them safe to store directly in reactive UI state.## Fallback Strategy@@ -70,20 +130,20 @@ Browser support for Temporal: Limited availability.Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).Unsupported in: Safari.-For browsers that do not yet support the native `Temporal` API, use feature detection and a polyfill. The standard reference polyfill is `@js-temporal/polyfill`.+For browsers that do not yet support the native `Temporal` API, use feature detection and dynamically load `temporal-polyfill` (~15 KB min+gz).-Note that the polyfill does not automatically assign the `Temporal` object to the global scope to avoid conflicts. You must manually assign it if your code relies on the global `Temporal` object.+Note that importing `temporal-polyfill` does not automatically assign the `Temporal` object to the global scope. Assign it explicitly if your code relies on `globalThis.Temporal`.```javascript// Check if Temporal is supported natively(async () => {if (typeof Temporal === 'undefined') {// Load the polyfill conditionally- const module = await import("https://esm.sh/@js-temporal/polyfill");+ const module = await import('https://esm.sh/temporal-polyfill');globalThis.Temporal = module.Temporal;// Extend Date.prototype if neededDate.prototype.toTemporalInstant = module.toTemporalInstant;- initializeApp();}+ initializeApp();})();-```\ No newline at end of file+```diff --git a/skills/modern-web-guidance/guides/js/coordinate-global-events.md b/skills/modern-web-guidance/guides/js/coordinate-global-events.mdindex 0066fe6..83a5271 100644--- a/skills/modern-web-guidance/guides/js/coordinate-global-events.md+++ b/skills/modern-web-guidance/guides/js/coordinate-global-events.md@@ -53,29 +53,28 @@ console.log(`Tokyo time: ${tokyoTime.toLocaleString('en-US', { hour: 'numeric',- **DO** use `.withTimeZone()` to calculate the equivalent time in other locations without mutating the original object (Temporal objects are immutable).- **DO** use native `.toLocaleString()` formatting (such as `{ hour: 'numeric', minute: '2-digit' }`) for user-facing time displays instead of manual time calculations and padding.-### Fallback strategies+## Fallback Strategy++### Fallbacks & browser support for TemporalBrowser support for Temporal: Limited availability.Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).Unsupported in: Safari.-For environments without native `Temporal` support, you must conditionally load the `@js-temporal/polyfill`.+For browsers that do not yet support the native `Temporal` API, use feature detection and dynamically load `temporal-polyfill` (~15 KB min+gz).++Note that importing `temporal-polyfill` does not automatically assign the `Temporal` object to the global scope. Assign it explicitly if your code relies on `globalThis.Temporal`.```javascript// Check if Temporal is supported natively(async () => {if (typeof Temporal === 'undefined') {// Load the polyfill conditionally- const module = await import("https://esm.sh/@js-temporal/polyfill");+ const module = await import('https://esm.sh/temporal-polyfill');globalThis.Temporal = module.Temporal;// Extend Date.prototype if neededDate.prototype.toTemporalInstant = module.toTemporalInstant;- initializeApp();}+ initializeApp();})();--function initializeApp() {- // Your app logic here- console.log("Temporal is ready:", typeof Temporal);-}```\ No newline at end of filediff --git a/skills/modern-web-guidance/guides/js/format-human-readable-durations.md b/skills/modern-web-guidance/guides/js/format-human-readable-durations.mddeleted file mode 100644index 77eed4f..0000000--- a/skills/modern-web-guidance/guides/js/format-human-readable-durations.md+++ /dev/null@@ -1,87 +0,0 @@-# Formatting Human-Readable Durations with Temporal--Presenting elapsed time or durations to users in a readable format (e.g., "1 hour and 30 minutes") has historically required manual math or external libraries. The `Temporal` API's `Temporal.Duration` class simplifies this by providing structured duration objects and powerful "balancing" capabilities via the `round()` method.--## How to Implement--To format a duration:--1. (**MANDATORY**) **Create a Duration**: Use `Temporal.Duration.from()` to create a duration object from a set of units.-2. (**OPTIONAL**) **Apply Balancing**: Use the `round()` method with the `largestUnit` option to control how units are balanced. For example, to convert 90 minutes into hours and minutes, or to keep it as total minutes.-3. (**MANDATORY**) **Build the Display String**: Access the specific unit properties (like `.hours`, `.minutes`) to construct the human-readable string manually, or **(Recommended)** use `Intl.DurationFormat` for a localized, automatic approach.--### Example: Balancing and Localized Formatting--```javascript-// 1. Create a duration (e.g., from user input)-const duration = Temporal.Duration.from({ minutes: 90 });--// 2. Balance to hours (converts 90 minutes to 1 hour and 30 minutes)-const balanced = duration.round({ largestUnit: 'hours' });--// 3. Format using Intl.DurationFormat (Handles pluralization automatically)-const formatter = new Intl.DurationFormat('en', { style: 'long' });-console.log(formatter.format(balanced));-// Note: Output may vary by browser (e.g., "1 hour and 30 minutes" or "1 hour, 30 minutes")-```--### Best Practices--* **DO** use `Temporal.Duration.round()` with `largestUnit` to control the display strategy (detailed breakdown vs total count).-* **DO** use `Intl.DurationFormat` for localized string formatting and automatic pluralization, or fall back to manual construction if not supported.-* **DO NOT** rely on `Temporal.Duration.prototype.toString()` for user-facing text; it returns ISO 8601 strings (e.g., `PT1H30M`).-* **DO** use feature detection and a polyfill for environments lacking native support.--## Fallback strategies--### Fallbacks & browser support for Temporal--Browser support for Temporal: Limited availability.-Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).-Unsupported in: Safari.--For browsers that do not yet support the native `Temporal` API, use feature detection and a polyfill. The standard reference polyfill is `@js-temporal/polyfill`.--Note that the polyfill does not automatically assign the `Temporal` object to the global scope to avoid conflicts. You must manually assign it if your code relies on the global `Temporal` object.--```javascript-// Check if Temporal is supported natively-(async () => {- if (typeof Temporal === 'undefined') {- // Load the polyfill conditionally- const module = await import("https://esm.sh/@js-temporal/polyfill");- globalThis.Temporal = module.Temporal;- // Extend Date.prototype if needed- Date.prototype.toTemporalInstant = module.toTemporalInstant;- initializeApp();- }-})();-```--### Intl.DurationFormat--Baseline status for Intl.DurationFormat: Newly available. It's been Baseline since 2025-03-04.-Supported by: Chrome 129 (Sep 2024), Edge 129 (Sep 2024), Firefox 136 (Mar 2025), and Safari 16.4 (Mar 2023).--If `Intl.DurationFormat` is not supported, you should feature-detect it and fall back to manual string construction by extracting the balanced duration properties.--* **Guidance:** Use `typeof Intl.DurationFormat !== 'undefined'` to check for support. If unsupported, extract properties like `.hours` and `.minutes` from the balanced `Temporal.Duration` object and combine them, handling pluralization properly.--```javascript-// 3. Format the display string--if (typeof Intl.DurationFormat !== 'undefined') {- // Use recommended Intl API if available- const formatter = new Intl.DurationFormat('en', { style: 'long' });- console.log(formatter.format(balanced));-} else {- // Fallback manual formatting (assuming duration is already balanced)- const h = balanced.hours;- const m = balanced.minutes;-- const hoursStr = `${h} hour${h === 1 ? '' : 's'}`;- const minutesStr = `${m} minute${m === 1 ? '' : 's'}`;-- console.log(`${hoursStr} and ${minutesStr}`);-}-```\ No newline at end of filediff --git a/skills/modern-web-guidance/guides/js/manage-recurring-intervals.md b/skills/modern-web-guidance/guides/js/manage-recurring-intervals.mddeleted file mode 100644index bfc242b..0000000--- a/skills/modern-web-guidance/guides/js/manage-recurring-intervals.md+++ /dev/null@@ -1,73 +0,0 @@-# Managing Recurring Intervals with Temporal--Calculating recurring intervals, such as subscription billing cycles or payroll periods, has historically been error-prone with the legacy `Date` object. Adding a month to a date like January 31st is ambiguous (should it be February 28th/29th or March 3rd?).--The `Temporal` API provides a clean solution with `Temporal.PlainDate` and its `.add()` method, which handles month-end transitions predictably using configurable overflow strategies.--## How to Implement--1. **MANDATORY:** **Parse the starting date**: Use `Temporal.PlainDate.from()` to create a date object.-2. **MANDATORY:** **Add the duration**: Use the `.add()` method with a duration object (e.g., `{ months: 1 }`).-3. **OPTIONAL:** **Specify overflow behavior**: Use the `overflow` option to control how invalid dates (like Feb 31) are handled.- - `'constrain'` (default): Clamps to the last valid day of the month.- - `'reject'`: Throws a `RangeError`.--### Example: Subscription Billing Cycle--```javascript-// 1. Parse the start date (e.g., billing starts on Jan 31st)-const startDate = Temporal.PlainDate.from('2024-01-31');--// 2. Add 1 month with default 'constrain' overflow-// Jan 31 + 1 month -> Feb 29 (2024 is a leap year)-const nextBillingDate = startDate.add({ months: 1 });-console.log(`Next billing: ${nextBillingDate.toString()}`); // 2024-02-29--// 3. Add 1 month to Feb 29-// Feb 29 + 1 month -> Mar 29-// Note: Day is preserved if valid, otherwise constrained.-const thirdBillingDate = nextBillingDate.add({ months: 1 });-console.log(`Third billing: ${thirdBillingDate.toString()}`); // 2024-03-29--// Example with 'reject' strategy-try {- // Jan 31 + 1 month with 'reject' throws because Feb 31 is invalid- const invalidDate = startDate.add({ months: 1 }, { overflow: 'reject' });-} catch (e) {- console.log("Caught expected error:", e.name); // RangeError-}-```--## Strategic Implementation & Best Practices--- **DO** use `Temporal.PlainDate` for calculations that do not depend on specific times or time zones (like calendar dates or billing cycles).-- **DO** understand the default `constrain` behavior. It is usually what users expect for billing (e.g., Jan 31 -> Feb 28/29 -> Mar 28/29).-- **DO NOT** modify instances directly; `Temporal` objects are **immutable**. Operations return a new instance.-- **DO** use `overflow: 'reject'` if you need to enforce that the resulting date must exist in the calendar and handle failures explicitly.--### Fallback strategies--Browser support for Temporal: Limited availability.-Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).-Unsupported in: Safari.--For browsers that do not yet support the native `Temporal` API, use feature detection and a polyfill. The standard reference polyfill is `@js-temporal/polyfill`.--```javascript-// Check if Temporal is supported natively-(async () => {- if (typeof Temporal === 'undefined') {- // Load the polyfill conditionally- const module = await import("https://esm.sh/@js-temporal/polyfill");- globalThis.Temporal = module.Temporal;- // Extend Date.prototype if needed- Date.prototype.toTemporalInstant = module.toTemporalInstant;- initializeApp();- }-})();--function initializeApp() {- const date = Temporal.PlainDate.from('2024-01-31');- console.log(date.add({ months: 1 }).toString());-}-```\ No newline at end of filediff --git a/skills/modern-web-guidance/guides/js/model-partial-time-concepts.md b/skills/modern-web-guidance/guides/js/model-partial-time-concepts.mddeleted file mode 100644index b842b9e..0000000--- a/skills/modern-web-guidance/guides/js/model-partial-time-concepts.md+++ /dev/null@@ -1,96 +0,0 @@-# Modeling Partial Time Concepts with Temporal--Modeling date concepts that lack a full calendar date—such as credit card expirations, annual renewals, or daily alarms—has historically been error-prone with the legacy `Date` object. Developers often resort to using arbitrary days (like the 1st of the month) or parsing strings, leading to "day leakage" or incorrect calculations due to leap years and varying month lengths.--The `Temporal` API provides dedicated types for these partial concepts: `Temporal.PlainYearMonth`, `Temporal.PlainMonthDay`, and `Temporal.PlainTime`. These types ensure precision and avoid leaking irrelevant date components.--## Implementation Examples--### Monthly Expirations (Credit Cards, Billing Cycles)-Use `Temporal.PlainYearMonth` to represent a year and a month.--```javascript-// Create a PlainYearMonth from values-// Use explicit calendar to avoid mismatch issues in polyfill environments-const expiry = Temporal.PlainYearMonth.from({ year: 2027, month: 12, calendar: 'iso8601' });--// Get the current year/month-const currentMonth = Temporal.Now.plainDateISO().toPlainYearMonth();--// Calculate duration until expiry-// largestUnit ensures the difference is expressed in years if applicable-const duration = currentMonth.until(expiry, { largestUnit: 'years' });--if (duration.sign < 0) {- console.log("Expired");-} else if (duration.sign === 0) {- console.log("Expires this month");-} else {- console.log(`Expires in ${duration.years} years and ${duration.months} months`);-}-```--### Annual Recurring Dates (Birthdays, Renewals)-Use `Temporal.PlainMonthDay` to represent a month and a day without a year.--```javascript-// Create a PlainMonthDay for an annual event-// Include explicit calendar for polyfill safety-const birthday = Temporal.PlainMonthDay.from({ month: 10, day: 31, calendar: 'iso8601' });--// Check if it matches today's date components-const today = Temporal.Now.plainDateISO();-const isBirthdayToday = birthday.equals(today.toPlainMonthDay());--// To perform arithmetic (like days until next occurrence), convert to a full PlainDate-// by providing a specific year.-const birthdayThisYear = birthday.toPlainDate({ year: today.year });-```--### Wall-Clock Time (Alarms, Store Hours)-Use `Temporal.PlainTime` to represent a time of day without a date.--```javascript-// Create a PlainTime from a string-const alarmTime = Temporal.PlainTime.from("08:00:00");--// Add a duration to a PlainTime-const snoozedTime = alarmTime.add({ minutes: 10 });--console.log(`Original alarm: ${alarmTime.toString()}`);-console.log(`Snoozed alarm: ${snoozedTime.toString()}`);-```--## Strategic Implementation & Best Practices--- **DO** use `Temporal.PlainYearMonth` for values that only specify a month and year (like credit card expiry) to avoid leaking arbitrary day values.-- **DO** use `Temporal.PlainMonthDay` for annual events that ignore the year (like birthdays or anniversaries).-- **DO** use `Temporal.PlainTime` for daily schedules or alarms that are independent of the date.-- **DO NOT** try to perform arithmetic directly on `PlainMonthDay`. Convert it to a `PlainDate` first by providing a year, as the length of months varies by year.-- **DO** use explicit calendar properties (like `calendar: 'iso8601'`) when creating instances from objects to ensure safety across polyfill implementations.--## Fallback Strategy--### Fallbacks & browser support for Temporal--Browser support for Temporal: Limited availability.-Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).-Unsupported in: Safari.--For browsers that do not yet support the native `Temporal` API, use feature detection and a polyfill. The standard reference polyfill is `@js-temporal/polyfill`.--Note that the polyfill does not automatically assign the `Temporal` object to the global scope to avoid conflicts. You must manually assign it if your code relies on the global `Temporal` object.--```javascript-// Check if Temporal is supported natively-(async () => {- if (typeof Temporal === 'undefined') {- // Load the polyfill conditionally- const module = await import("https://esm.sh/@js-temporal/polyfill");- globalThis.Temporal = module.Temporal;- // Extend Date.prototype if needed- Date.prototype.toTemporalInstant = module.toTemporalInstant;- initializeApp();- }-})();-```diff --git a/skills/modern-web-guidance/guides/js/sequence-distributed-events.md b/skills/modern-web-guidance/guides/js/sequence-distributed-events.mddeleted file mode 100644index 48b2b0a..0000000--- a/skills/modern-web-guidance/guides/js/sequence-distributed-events.md+++ /dev/null@@ -1,91 +0,0 @@-# Sequencing Distributed Events--Tracing dashboards, audit logs, and telemetry viewers often receive events from many services, each stamped by a central source such as a database, message broker, or log pipeline. Those timestamps are frequently recorded with microsecond or nanosecond precision (for example, `2026-04-01T12:00:00.000123456Z`). The legacy `Date` object can only represent milliseconds, so parsing such strings with `new Date()` silently truncates the fractional seconds, causing events that occurred at different times to appear simultaneous and sort in an unstable order.--`Temporal.Instant` represents an exact point on the UTC timeline with nanosecond precision and no attached time zone. That makes it the right type for events that were all measured against the same clock: it preserves the full precision of the recorded timestamp, sorts unambiguously, and yields an exact `Temporal.Duration` between any two events.--## How to Implement--To sequence events that arrive with high-precision timestamps:--1. **Parse the recorded timestamps as `Temporal.Instant`**: Use `Temporal.Instant.from(isoString)` on the timestamp string supplied by the server, database, or log line. Keep the timestamp the source recorded; do not replace it with a timestamp captured in the browser.-2. **Sort events chronologically**: Use `Temporal.Instant.compare(a, b)` as the comparator passed to `Array.prototype.sort()`. It compares the full nanosecond value, so sub-millisecond ordering is preserved.-3. **Calculate intervals**: Use `instant.since(previousInstant)` to get a `Temporal.Duration` between consecutive events. Use `a.equals(b)` to detect events with identical timestamps.-4. **Display intervals with `toLocaleString()`**: Format the `Temporal.Duration` for users with `duration.toLocaleString()`, which uses `Intl.DurationFormat` under the hood. Do not convert to a single `Number` of nanoseconds for display.-5. **Serialize for transmission**: Use `Temporal.Instant.prototype.toString()` to emit a standard ISO 8601 string (always in UTC with a `Z` suffix) when sending events onward.--## Example Code: Sequencing a Server-Side Trace--```javascript-// Events as received from a central source (for example, a tracing backend).-// The timestamps were all recorded against the same clock, so they can be-// ordered and compared with each other exactly.-const rawEvents = [- { nodeId: 'api-2', eventType: 'db.query', ts: '2026-04-01T12:00:00.000123456Z' },- { nodeId: 'api-1', eventType: 'request.start', ts: '2026-04-01T12:00:00.000120000Z' },- { nodeId: 'api-2', eventType: 'request.end', ts: '2026-04-01T12:00:00.000987654Z' },-];--// 1. Parse recorded timestamps as Temporal.Instant (never `new Date(ts)`,-// which drops everything below the millisecond).-const events = rawEvents.map(evt => ({- ...evt,- timestamp: Temporal.Instant.from(evt.ts),-}));--// 2. Sort chronologically with the static compare() method-function sequenceEvents(events) {- // Instant.compare returns -1, 0, or 1, which is exactly what sort() expects.- return [...events].sort((a, b) => Temporal.Instant.compare(a.timestamp, b.timestamp));-}--// 3. Calculate and display the interval between consecutive events-function analyzeTrace(sortedEvents) {- for (let i = 1; i < sortedEvents.length; i++) {- const prev = sortedEvents[i - 1];- const curr = sortedEvents[i];-- // since() returns a Temporal.Duration that retains nanosecond precision.- const gap = curr.timestamp.since(prev.timestamp);-- // 4. toLocaleString() formats the duration for people (e.g., "3μs 456ns").- // Avoid gap.total('nanoseconds'): spans over ~104 days exceed Number.MAX_SAFE_INTEGER.- // 'en-US' is used here for deterministic output; pass undefined to use the user's locale.- console.log(`${prev.eventType} → ${curr.eventType}: ${gap.toLocaleString('en-US', { style: 'narrow' })}`);- }-}--analyzeTrace(sequenceEvents(events));-```--## Strategic Implementation & Best Practices--- **DO** use `Temporal.Instant` for timestamps that were all recorded against one clock (a server, database, or log pipeline) and only need to be ordered or differenced. This is the canonical case for `Instant` rather than `Temporal.PlainDateTime`, which has no offset and therefore cannot be placed unambiguously on the timeline.-- **DO** keep the timestamp recorded by the source. Browsers deliberately coarsen `Temporal.Now.instant()` to mitigate timing attacks and fingerprinting (the spec explicitly permits this), so it does not give sub-millisecond resolution; for local in-page timing use `performance.now()` / `performance.mark()`, and for cross-service ordering use the timestamp recorded by the source.-- **DO** use `Temporal.Instant.compare()` for sorting and `a.equals(b)` for equality checks; do not compare `Instant.compare(a, b) === 0` or compare `toString()` output.-- **DO NOT** parse high-precision timestamp strings with `new Date()` or `Date.parse()` for ordering, because they truncate to milliseconds and produce collisions.-- **DO NOT** collapse an interval to a single number for display. `duration.total('nanoseconds')` returns a `Number`, which exceeds `Number.MAX_SAFE_INTEGER` for spans longer than ~104 days and silently loses precision. Subtracting `epochNanoseconds` (a `BigInt`) is exact but discards unit structure and usually ends up converted to `Number`; keep intervals as `Temporal.Duration` and format them with `toLocaleString()`.-- **DO** convert an `Instant` to `Temporal.ZonedDateTime` with `instant.toZonedDateTimeISO(timeZone)` when you need to show the wall-clock time of an event to a user.-- **DO** verify that the environment supports `Temporal` before using it natively or providing a fallback.--## Fallback strategies--Browser support for Temporal: Limited availability.-Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).-Unsupported in: Safari.--For environments without native support, use a standards-compliant polyfill such as `@js-temporal/polyfill`. Load it conditionally to avoid bloating the payload for modern clients. Note that `@js-temporal/polyfill` does not automatically install a global `Temporal` object, so you must explicitly assign it if you need it globally.--```javascript-(async () => {- // Check for native support- if (typeof Temporal === 'undefined') {- // Dynamically load polyfill using an ESM-compatible CDN- const module = await import('https://esm.sh/@js-temporal/polyfill');- // The polyfill does not auto-install globally, so we must assign it- globalThis.Temporal = module.Temporal;- }-- // Proceed with application logic-})();-```diff --git a/skills/modern-web-guidance/guides/js/sort-high-precision-timestamps.md b/skills/modern-web-guidance/guides/js/sort-high-precision-timestamps.mdnew file mode 100644index 0000000..95d88de--- /dev/null+++ b/skills/modern-web-guidance/guides/js/sort-high-precision-timestamps.md@@ -0,0 +1,92 @@+# Sorting High-Precision Timestamps with Temporal.Instant++Log viewers, audit timelines, and telemetry UIs often ingest events whose ISO 8601 timestamps were recorded with microsecond or nanosecond precision by a server, database, or native clock (for example, `2026-04-01T12:00:00.000123456Z`). Because the legacy `Date` object only stores milliseconds, parsing those strings with `new Date()` or `Date.parse()` silently truncates sub-millisecond digits, causing distinct events within the same millisecond to collide and sort in an unstable order.++`Temporal.Instant` represents an exact point on the UTC timeline with nanosecond precision and no attached time zone. When parsing pre-recorded high-precision timestamps with `Temporal.Instant.from()`, it preserves the full nanosecond value, sorts deterministically with `Temporal.Instant.compare()`, and computes exact `Temporal.Duration` intervals between events. Note that in browsers, `Temporal.Now.instant()` is deliberately clamped to millisecond or microsecond resolution for Spectre timing-attack mitigation—use `Temporal.Instant.from()` to preserve nanosecond timestamps produced by external clocks, and use `performance.now()` when measuring sub-millisecond intervals locally in the client.++## How to Implement++To parse, sort, and measure intervals between high-precision timestamps:++1. **Parse recorded timestamps as `Temporal.Instant`**: Use `Temporal.Instant.from(isoString)` on the timestamp string supplied by the server, database, or log line. Keep the timestamp the source recorded; do not replace it with `Temporal.Now.instant()` in the browser.+2. **Sort events chronologically**: Use `Temporal.Instant.compare(a, b)` as the comparator passed to `Array.prototype.sort()` or `Array.prototype.toSorted()`. It compares the full nanosecond value so sub-millisecond ordering is preserved.+3. **Calculate intervals**: Use `instant.since(previousInstant)` to get a `Temporal.Duration` between consecutive events. Use `a.equals(b)` to detect events with identical timestamps.+4. **Display intervals with `toLocaleString()`**: Format the `Temporal.Duration` for users with `duration.toLocaleString()`, which delegates to `Intl.DurationFormat`. Do not convert to a single `Number` of nanoseconds for display.+5. **Serialize for transmission**: Use `Temporal.Instant.prototype.toString()` to emit a standard ISO 8601 string (always in UTC with a `Z` suffix).++## Example Code: Sorting High-Precision Timestamps++```javascript+// Events received with nanosecond-precision ISO 8601 timestamps.+const rawEvents = [+ { nodeId: 'api-2', eventType: 'db.query', ts: '2026-04-01T12:00:00.000123456Z' },+ { nodeId: 'api-1', eventType: 'request.start', ts: '2026-04-01T12:00:00.000120000Z' },+ { nodeId: 'api-2', eventType: 'request.end', ts: '2026-04-01T12:00:00.000987654Z' },+];++// 1. Parse recorded timestamps as Temporal.Instant (never `new Date(ts)`,+// which drops everything below the millisecond).+const events = rawEvents.map(evt => ({+ ...evt,+ timestamp: Temporal.Instant.from(evt.ts),+}));++// 2. Sort chronologically with the static compare() method+function sequenceEvents(items) {+ // Instant.compare returns -1, 0, or 1, which is what sort() expects.+ return [...items].sort((a, b) => Temporal.Instant.compare(a.timestamp, b.timestamp));+}++// 3. Calculate and display the interval between consecutive events+function analyzeTrace(sortedEvents) {+ for (let i = 1; i < sortedEvents.length; i++) {+ const prev = sortedEvents[i - 1];+ const curr = sortedEvents[i];++ // since() returns a Temporal.Duration that retains nanosecond precision.+ const gap = curr.timestamp.since(prev.timestamp);++ // 4. toLocaleString() formats the duration for people (e.g., "3μs 456ns").+ // Avoid gap.total('nanoseconds'): spans over ~104 days exceed Number.MAX_SAFE_INTEGER.+ // 'en-US' is used here for deterministic output; pass undefined to use the user's locale.+ console.log(`${prev.eventType} → ${curr.eventType}: ${gap.toLocaleString('en-US', { style: 'narrow' })}`);+ }+}++analyzeTrace(sequenceEvents(events));+```++## Strategic Implementation & Best Practices++- **DO** use `Temporal.Instant.from()` for parsing high-precision timestamps recorded against a single clock (such as a server, database, or log pipeline) that need to be ordered or differenced. Unlike `Temporal.PlainDateTime`, `Temporal.Instant` represents an unambiguous point on the universal timeline.+- **DO** keep the timestamp recorded by the source. In browsers, `Temporal.Now.instant()` is clamped to millisecond/microsecond precision for Spectre timing-attack and fingerprinting mitigation; use `performance.now()` / `performance.mark()` for local sub-millisecond client intervals, and `Temporal.Instant.from()` for parsing nanosecond timestamps from server or native clocks.+- **DO** use `Temporal.Instant.compare()` for sorting and `a.equals(b)` for equality checks; do not check `Temporal.Instant.compare(a, b) === 0` or compare `.toString()` output.+- **DO NOT** parse high-precision timestamp strings with `new Date()` or `Date.parse()` for ordering, because they truncate to milliseconds and produce collisions.+- **DO NOT** collapse an interval to a single number for display. `duration.total('nanoseconds')` returns a `Number`, which exceeds `Number.MAX_SAFE_INTEGER` for spans longer than ~104 days and silently loses precision. Subtracting `epochNanoseconds` (a `BigInt`) is exact but discards unit structure; keep intervals as `Temporal.Duration` and format them with `.toLocaleString()`.+- **DO** convert an `Instant` to `Temporal.ZonedDateTime` with `instant.toZonedDateTimeISO(timeZone)` when you need to display the localized wall-clock time of an event to a user.++## Fallback Strategy++### Fallbacks & browser support for Temporal++Browser support for Temporal: Limited availability.+Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).+Unsupported in: Safari.++For browsers that do not yet support the native `Temporal` API, use feature detection and dynamically load `temporal-polyfill` (~15 KB min+gz).++Note that importing `temporal-polyfill` does not automatically assign the `Temporal` object to the global scope. Assign it explicitly if your code relies on `globalThis.Temporal`.++```javascript+// Check if Temporal is supported natively+(async () => {+ if (typeof Temporal === 'undefined') {+ // Load the polyfill conditionally+ const module = await import('https://esm.sh/temporal-polyfill');+ globalThis.Temporal = module.Temporal;+ // Extend Date.prototype if needed+ Date.prototype.toTemporalInstant = module.toTemporalInstant;+ }+ initializeApp();+})();+```diff --git a/skills/modern-web-guidance/guides/js/stabilize-reactive-state.md b/skills/modern-web-guidance/guides/js/stabilize-reactive-state.mddeleted file mode 100644index abaf4ae..0000000--- a/skills/modern-web-guidance/guides/js/stabilize-reactive-state.md+++ /dev/null@@ -1,72 +0,0 @@-# Stabilize Reactive State with Temporal--While some reactive systems (like [React](https://react.dev/)) rely strictly on reference equality to detect state changes, others (like [Vue](https://vuejs.org/) and [Svelte](https://svelte.dev/)) can track mutations to plain objects. However, for built-in objects like the legacy `Date` object, internal mutations (like `setHours()`) do not change the object's reference and are generally not tracked by any framework's default reactivity system. This leads to missed UI updates and hard-to-debug side effects.--The `Temporal` API solves this by providing immutable objects. Any operation that modifies a value (such as adding time or setting a field) returns a new instance with a new memory reference. This guarantees that state updates are always detected by reactive systems, ensuring UI stability.--## How to Implement--To stabilize reactive state using Temporal:--1. **Use Temporal types for state:** Store `Temporal` objects (like `Temporal.PlainDateTime` or `Temporal.PlainDate`) in your reactive state instead of legacy `Date` objects.-2. **Perform immutable updates:** When updating the state, use Temporal methods like `.add()`, `.subtract()`, or `.with()`. These methods return a new object.-3. **Pass the new reference to the state setter:** Use the newly created Temporal object to update your component state, triggering a reliable re-render.--## Example Code: Temporal vs Legacy Date in State--```javascript-// ❌ BAD: Mutating legacy Date breaks reactivity-let dateState = { deadline: new Date() };--function extendDeadlineBad() {- // Mutates the object in place. Reference remains the same!- dateState.deadline.setHours(dateState.deadline.getHours() + 1);-- // Frameworks will skip re-rendering because- // prevState === nextState (same memory reference)- updateState(dateState);-}--// ✅ GOOD: Temporal ensures immutability and reliable reactivity-let temporalState = { deadline: Temporal.Now.plainDateTimeISO() };--function extendDeadlineGood() {- // Returns a new object with a new reference.- const newDeadline = temporalState.deadline.add({ hours: 1 });-- // Create a new state object with the new Temporal reference- temporalState = { deadline: newDeadline };-- // Frameworks will detect the reference change and re-render the UI- updateState(temporalState);-}-```--## Strategic Implementation & Best Practices--- **DO** use `Temporal` for any date/time values stored in reactive state to benefit from its immutability.-- **DO** use the most specific Temporal type for your use case (e.g., `Temporal.PlainDate` if you only need the calendar date) to avoid unnecessary complexity.-- **DO NOT** mutate `Date` objects in place when they are part of a component's state.-- **DO** ensure you handle environments without native support by conditionally loading a polyfill.--### Fallback strategies--Browser support for Temporal: Limited availability.-Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).-Unsupported in: Safari.--Since the `Temporal` API is a newer feature and may not be supported in all browsers, you should feature-detect it and conditionally load a polyfill if needed.--```html-<!-- Conditionally load the Temporal polyfill only if not natively supported -->-<script>- if (typeof Temporal === "undefined") {- try {- const module = await import("https://esm.sh/@js-temporal/polyfill");- globalThis.Temporal = module.Temporal;- } catch (e) {- console.error("Failed to load Temporal polyfill:", e);- }- }-</script>-```\ No newline at end of filediff --git a/skills/modern-web-guidance/guides/js/support-global-calendar-systems.md b/skills/modern-web-guidance/guides/js/support-global-calendar-systems.mdindex 38029fb..b88d7d5 100644--- a/skills/modern-web-guidance/guides/js/support-global-calendar-systems.md+++ b/skills/modern-web-guidance/guides/js/support-global-calendar-systems.md@@ -55,11 +55,12 @@ const comparison = Temporal.PlainDate.compare(targetDate, today);const relative = comparison < 0 ? 'Past' : comparison > 0 ? 'Future' : 'Today';console.log(`Timeline: ${relative}`);-// 7. Format for display using toLocaleString+// 7. Format for display using toLocaleString (including era for era-based calendars like 'japanese')const localizedDisplay = targetDate.toLocaleString('en-u-ca-hebrew', {day: 'numeric',month: 'long',- year: 'numeric'+ year: 'numeric',+ era: 'long'});```@@ -77,31 +78,26 @@ const localizedDisplay = targetDate.toLocaleString('en-u-ca-hebrew', {## Fallback Strategy+### Fallbacks & browser support for Temporal+Browser support for Temporal: Limited availability.Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 139 (May 2025).Unsupported in: Safari.-For production use in browsers that do not support it natively, you must use a polyfill.+For browsers that do not yet support the native `Temporal` API, use feature detection and dynamically load `temporal-polyfill` (~15 KB min+gz).-The recommended approach is to progressively enhance by checking for native support and dynamically loading a polyfill like `@js-temporal/polyfill` if needed.+Note that importing `temporal-polyfill` does not automatically assign the `Temporal` object to the global scope. Assign it explicitly if your code relies on `globalThis.Temporal`.```javascript-/**- * Progressive Enhancement Fallback- */-async function getTemporal() {- if (typeof Temporal !== 'undefined') {- return Temporal;- }-- try {- // Load polyfill dynamically from CDN- const module = await import('https://esm.sh/@js-temporal/polyfill');+// Check if Temporal is supported natively+(async () => {+ if (typeof Temporal === 'undefined') {+ // Load the polyfill conditionally+ const module = await import('https://esm.sh/temporal-polyfill');globalThis.Temporal = module.Temporal;- return module.Temporal;- } catch (e) {- console.error('Failed to load Temporal polyfill:', e);- throw e;+ // Extend Date.prototype if needed+ Date.prototype.toTemporalInstant = module.toTemporalInstant;}-}+ initializeApp();+})();```diff --git a/skills/modern-web-guidance/guides/performance/conditional-async-dependencies.md b/skills/modern-web-guidance/guides/performance/conditional-async-dependencies.mdindex dd9209c..b75a7bb 100644--- a/skills/modern-web-guidance/guides/performance/conditional-async-dependencies.md+++ b/skills/modern-web-guidance/guides/performance/conditional-async-dependencies.md@@ -40,33 +40,35 @@ if (myPopover) {}```-### Avoiding the Safari top-level `await` bug+### Sequencing module imports and avoiding the pre-Safari 27 bug-**MANDATORY:** You must structure your imports carefully to avoid a bug where top-level await doesn't behave as expected in Webkit, which occurs when multiple modules *simultaneously* import a module that contains a top-level `await`:+**MANDATORY:** You must structure your module graph so the top-level `await` module is imported from a single entry point and completes before downstream modules evaluate:++* **DO NOT place sibling static imports in an entry file** (for example, `import './conditionally-load-polyfill.js'; import './app.js';`). Per the ECMAScript module evaluation specification, top-level `await` only suspends the parent module that imports it—not sibling static imports—so `./app.js` will evaluate concurrently in all browsers before the polyfill finishes loading.+* **DO NOT import the top-level `await` module from multiple sibling modules simultaneously** (for example, having both `a.js` and `b.js` statically import `./conditionally-load-polyfill.js`). While [Safari 27 fixed WebKit's module loader](https://webkit.org/blog/18227/fixing-top-level-await-in-safari/) to support concurrent imports of top-level `await` modules per spec, Safari 15–26.6 fails when multiple modules simultaneously import a module containing a top-level `await` (see [MDN browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#browser_compatibility)).++Instead, choose one of two patterns depending on your module structure:++1. **Single entry module (shown in `main.js` above):** If your entry module runs the dependent initialization logic directly, statically import `./conditionally-load-polyfill.js` at the top of that module and run your code in its body.+2. **Bootstrapping separate application modules:** If your entry module delegates to downstream application modules (such as `./app.js`), chain dynamic `import()` calls with top-level `await` so `./app.js` is only fetched and evaluated after the polyfill module resolves:```javascript-// DO NOT do this: importing the top-level await module from multiple sibling modules-// simultaneously will crash in Safari.-//-// a.js: import './conditionally-load-polyfill.js';-// b.js: import './conditionally-load-polyfill.js';-// main.js: import './a.js'; import './b.js'; // CRASH!--// INSTEAD, guarantee a single entry point:-// Import the top-level await module ONCE at the very top of your application tree.-import './conditionally-load-polyfill.js';+// main.js-// Then import the rest of your application code, ensuring the await resolves first.-import './app.js';+// MANDATORY: Chain dynamic imports with top-level await when bootstrapping separate+// application modules so './app.js' waits for the polyfill to finish loading.+// DO NOT use sibling static imports (`import './conditionally-load-polyfill.js'; import './app.js';`),+// which evaluate concurrently and execute './app.js' before the polyfill is ready.+await import('./conditionally-load-polyfill.js');+await import('./app.js');```### Fallback strategiesBaseline status for Top-level await: Newly available. It's been Baseline since 2026-09-14.-Supported by: Chrome 89 (Mar 2021), Edge 89 (Mar 2021), Firefox 89 (Jun 2021), and Safari 27.--Top-level `await` has been supported in all major browsers since 2021 (Chrome 89, Firefox 89, Safari 15). Because of this broad support, **you do not need to implement a fallback strategy for modern web applications.**+Supported by: Chrome 89 (Mar 2021), Edge 89 (Mar 2021), Firefox 89 (Jun 2021), and Safari 27 (Sep 2026).-As long as you follow the guidance in the previous section to **avoid the Safari execution order bug**, you can safely rely on top-level `await` directly to manage your async dependencies.+While basic top-level `await` has been supported across major browsers since 2021 (Chrome 89, Edge 89, Firefox 89, and Safari 15), it only reached full spec compliance in [Safari 27](https://webkit.org/blog/18227/fixing-top-level-await-in-safari/) (see [MDN browser compatibility](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#browser_compatibility)).-You only need to avoid top-level `await` and fall back to standard asynchronous functions or dynamic `import()` orchestration if your application is explicitly required to support legacy browsers released before 2021.+* **Safari 15–26.6:** As long as you follow the single-entry-point pattern in the previous section so multiple sibling modules do not concurrently import the top-level `await` module, you can safely rely on top-level `await` without an additional fallback.+* **Legacy browsers (pre-2021):** If your application must support browsers without any top-level `await` support, avoid top-level `await` and wrap your conditional `import()` orchestration in a standard `async` function or `.then()` promise chain.diff --git a/skills/modern-web-guidance/guides/performance/identify-inp-causes.md b/skills/modern-web-guidance/guides/performance/identify-inp-causes.mdindex e45d11a..e7f1170 100644--- a/skills/modern-web-guidance/guides/performance/identify-inp-causes.md+++ b/skills/modern-web-guidance/guides/performance/identify-inp-causes.md@@ -4,9 +4,14 @@ Poor responsiveness to interactions leads to a poor impression of a page being sIdentifying root causes of an unresponsive web page can be tricky especially as it depends on user interactions and environmental conditions such as device capabilities and network conditions. This makes it even more difficult to diagnose compared to a more repeatable and predictable scenario like page load. Lab data only replicates a small subset of real user scenarios so measuring the causes of slow INP in the field is essential.-The Event Timing API allows for splitting the INP duration into three subparts: Input Delay (processing that is already happing when the interaction happens), Processing Duration (delays due as a direct result of the interaction), and Presentation Delay (delays that are due to rendering the next frame after the interaction). This helps identify if the issue is in other code, the interaction JavaScript code, or browser processing rendering updates respectively rather than jumping straight to the interaction code.+The Event Timing API allows for splitting the INP duration into three subparts: Input Delay (processing that is already happening when the interaction happens), Processing Duration (delays due as a direct result of the interaction), and Presentation Delay (delays that are due to rendering the next frame after the interaction). This helps identify if the issue is in other code, the interaction JavaScript code, or browser processing rendering updates respectively rather than jumping straight to the interaction code.-It is possible to gather further insights for JavaScript code delaying an interaction. A full performance trace using the JS Self-Profiling API is a heavyweight solution that is liable to cause performance problems. The Long Animation Frames API is a lightweight API that can be used to identify slow running JavaScript in the field for INP interactions.+It is possible to gather further insights into JavaScript, style recalculation, and layout work delaying an interaction. A full performance trace using the JS Self-Profiling API is a heavyweight solution that is liable to cause performance problems. The Long Animation Frames API is a lightweight API that can be used in the field to identify slow-running JavaScript and distinguish between style recalculation and layout costs during INP interactions:++- **Script-level forced style and layout (`forcedStyleDuration` and `forcedLayoutDuration`):** Reports synchronous style recalculations (such as calling `getComputedStyle()` after DOM mutations) and forced layouts/reflows (such as reading `getBoundingClientRect()` or `offsetWidth` after mutations) inside a running script during **Input Delay** or **Processing Duration**.+- **Frame-level rendering style and layout (`styleDuration` and `layoutDuration`):** Reports time spent recalculating styles versus updating layout during the frame's rendering update, helping explain high **Presentation Delay**.++Distinguishing style recalculation from layout is critical because they have different root causes and fixes: high style duration points to expensive CSS selector matching or broad style invalidation (remediated by simplifying selectors or reducing rule scope), whereas high layout duration points to expensive geometry calculations or synchronous layout thrashing (remediated by batching DOM reads before writes, simplifying DOM structure, or using CSS containment).## How to implement@@ -16,7 +21,7 @@ Calculating INP from the raw Event Timing API is complicated and has several nua## Get attributions for INP interactions using web-vitals library-The `web-vitals` library is a tiny library used to measure Core Web Vitals and other performance metrics. The `onINP()` function can be used to identify the slowest interaction and includes information about the INP subparts and scripts that were executed during the interaction using the Long Animation Frames API.+The `web-vitals` library is a tiny library used to measure Core Web Vitals and other performance metrics. The `onINP()` function can be used to identify the slowest interaction and includes information about the INP subparts, scripts that were executed during the interaction, and style and layout durations using the Long Animation Frames API.```javascript// Use the attribution build to get Long Animation Frame data@@ -24,28 +29,50 @@ The `web-vitals` library is a tiny library used to measure Core Web Vitals and oimport { onINP } from 'web-vitals/attribution';onINP((metric) => {- // Beacon script attribution for the longest script during the INP- // interaction, so you can identify the root cause in production.+ const { attribution } = metric;+ const longestScript = attribution.longestScript;++ // Sum rendering-phase style and layout durations across all LoAF entries+ // intersecting the INP interaction (primarily explains presentationDelay).+ let renderStyleDuration = 0;+ let renderLayoutDuration = 0;+ for (const entry of attribution.longAnimationFrameEntries) {+ renderStyleDuration += entry.styleDuration ?? 0;+ renderLayoutDuration += entry.layoutDuration ?? 0;+ }++ // Beacon script, style, and layout attribution for the INP interaction,+ // so you can identify the root cause in production.navigator.sendBeacon('/analytics',JSON.stringify({name: 'INP',value: metric.value,// These fields give the INP subparts:- inputDelay: metric.attribution.inputDelay,- presentationDelay: metric.attribution.presentationDelay,- processingDuration: metric.attribution.processingDuration,- interactionTarget: metric.attribution.interactionTarget,+ inputDelay: attribution.inputDelay,+ presentationDelay: attribution.presentationDelay,+ processingDuration: attribution.processingDuration,+ interactionTarget: attribution.interactionTarget,// These fields identify which script function was responsible// for the longest processing during the INP interaction.- invokerType: metric.attribution.longestScript.entry?.invokerType,- sourceURL: metric.attribution.longestScript.entry?.sourceURL,- sourceFunctionName: metric.attribution.longestScript.entry?.sourceFunctionName,- sourceCharPosition: metric.attribution.longestScript.entry?.sourceCharPosition,+ invokerType: longestScript?.entry?.invokerType,+ sourceURL: longestScript?.entry?.sourceURL,+ sourceFunctionName: longestScript?.entry?.sourceFunctionName,+ sourceCharPosition: longestScript?.entry?.sourceCharPosition,// subpart indicates which phase (input delay, processing, or// presentation delay) the longest script overlapped with most.- subpart: metric.attribution.longestScript.subpart,- intersectingDuration: metric.attribution.longestScript.intersectingDuration+ subpart: longestScript?.subpart,+ intersectingDuration: longestScript?.intersectingDuration,+ // Synchronous style and layout work forced inside the longest script+ // (with forcedStyleAndLayoutDuration as a combined fallback):+ forcedStyleDuration: longestScript?.entry?.forcedStyleDuration,+ forcedLayoutDuration: longestScript?.entry?.forcedLayoutDuration,+ forcedStyleAndLayoutDuration: longestScript?.entry?.forcedStyleAndLayoutDuration,+ // Rendering-phase style and layout work across the interaction's frames+ // (with totalStyleAndLayoutDuration as a combined fallback):+ renderStyleDuration,+ renderLayoutDuration,+ totalStyleAndLayoutDuration: attribution.totalStyleAndLayoutDuration}));});@@ -55,6 +82,7 @@ onINP((metric) => {- **DO** use INP subparts initially to identify whether the delay is already running JavaScript (input delay), the event handlers JavaScript for the interaction (processing duration), or the subsequent rendering (presentation delay).- **DO** attempt to identify the biggest blocking JavaScript as additional detail, particularly for input delay, and processing duration.+- **DO** distinguish between style recalculation (`styleDuration`, `forcedStyleDuration`) and layout (`layoutDuration`, `forcedLayoutDuration`) when diagnosing high processing duration or presentation delay: high style times indicate expensive CSS selectors or broad invalidations, while high layout times indicate DOM geometry bottlenecks or synchronous layout thrashing.- **DO** prefer the Long Animation Frames API for providing this further detail over alternatives like the JS Self-Profiling API, which carries higher runtime overhead.- **DO** use the `web-vitals` library if no other RUM solution is in place. It can identify the INP interaction and includes information about the subparts and the scripts that were executed during the interaction (using the Long Animation Frames API).- **DO** beacon back the required information to an analytics service rather than just log it locally.@@ -71,3 +99,7 @@ Supported by: Chrome 123 (Mar 2024) and Edge 123 (Mar 2024).Unsupported in: Firefox and Safari.The Long Animation Frames API provides optional, additional details. It can be safely used without fallbacks. In most cases the performance opportunities it identifies will apply to other browsers as well.++If your Baseline target supports the Long Animation Frames API (`long-animation-frames`) but does not support separate style and layout duration properties (`styleDuration` and `layoutDuration` on `PerformanceLongAnimationFrameTiming`, or `forcedStyleDuration` and `forcedLayoutDuration` on `PerformanceScriptTiming`), fall back to the combined style-and-layout timings:+- Use `script.forcedStyleAndLayoutDuration` on `PerformanceScriptTiming` for synchronous forced style and layout work inside scripts.+- Use `metric.attribution.totalStyleAndLayoutDuration` in `web-vitals/attribution` (or compute `(entry.paintTime || entry.startTime + entry.duration) - entry.styleAndLayoutStart` on each `PerformanceLongAnimationFrameTiming` entry) for combined style and layout work.diff --git a/skills/modern-web-guidance/guides/security/secure-external-subresources.md b/skills/modern-web-guidance/guides/security/secure-external-subresources.mdnew file mode 100644index 0000000..464250a--- /dev/null+++ b/skills/modern-web-guidance/guides/security/secure-external-subresources.md@@ -0,0 +1,202 @@+# Secure external subresources with Subresource Integrity, CORS, and Referrer Policy++When loading scripts, stylesheets, fonts, or images from third-party CDNs or external origins, verify their cryptographic integrity with Subresource Integrity (`integrity` in HTML and `integrity()` in CSS `url()`), configure cross-origin credential handling (`crossorigin` and `cross-origin()`), and restrict outgoing `Referer` headers (`referrerpolicy` and `referrer-policy()`). For document-level Content Security Policy and outbound connection allowlists, see `security` (via `npx -y modern-web-guidance@latest retrieve "security"`) and `restrict-outbound-connections` (via `npx -y modern-web-guidance@latest retrieve "restrict-outbound-connections"`).++## 1. Generate cryptographic integrity digests for immutable assets++Subresource Integrity (SRI) ensures the browser only executes or renders an external asset if its bytes match the cryptographic hash declared by your application.++- **Compute digests at build or release time, never from live untrusted responses**: Generate integrity hashes during your build or release step from known-good local asset bytes (or copy the official digest published by the package author) and hardcode them into your HTML, CSS, or JavaScript. Never fetch a third-party URL in the browser at runtime to compute its own `integrity` hash, which trusts whatever bytes the remote server returns and defeats SRI.+- **Use `sha384-` by default**: Format integrity metadata as `<algorithm>-<base64-digest>` using `sha384-` (recommended default), `sha512-`, or `sha256-`.+- **Pin external subresources to immutable, versioned URLs**: Always reference third-party assets using immutable, version-pinned or content-addressed URLs (such as `https://cdn.example.com/[email protected]/app.min.js`) rather than mutable floating URLs (`latest/app.min.js`), which expose your site to silent supply-chain changes and break SRI as soon as the remote file updates. If you must load a mutable third-party script that updates in place (such as a vendor analytics tag), omit `integrity` on that URL and restrict it with Content Security Policy (`strict-dynamic` / nonces) or iframe sandboxing instead.+- **Space-separate multiple digests when an endpoint may serve multiple valid payloads**: All browsers that support SRI implement `sha256-`, `sha384-`, and `sha512-`. If a URL may legitimately return one of several known-good payloads (such as during an A/B test, staged CDN rollout, or content-negotiated build), list multiple digests of the same algorithm separated by whitespace (for example, `integrity="sha384-variantA... sha384-variantB..."`). The browser accepts the response if it matches *any* listed digest of the strongest algorithm present.+- **Serve cross-origin subresources with CORS headers**: Browsers can only verify the integrity of a cross-origin response when it is CORS-readable (`Access-Control-Allow-Origin: *` for anonymous requests, or the exact requesting origin with `Access-Control-Allow-Credentials: true` for credentialed requests).++```bash+# Generate a sha384- SRI hash at build time from a known-good local file+printf "sha384-%s\n" "$(openssl dgst -sha384 -binary app.min.js | openssl base64 -A)"+```++```javascript+// Build-time / tooling helper (Node.js 19+, Deno, Bun) to compute an SRI string from known-good local bytes+export async function computeIntegrityMetadata(bytes) {+ const rawBytes =+ typeof bytes === 'string' ? new TextEncoder().encode(bytes) : bytes;+ const digestBuffer = await crypto.subtle.digest('SHA-384', rawBytes);+ const binary = Array.from(new Uint8Array(digestBuffer), (b) =>+ String.fromCharCode(b),+ ).join('');+ return `sha384-${btoa(binary)}`;+}+```++## 2. Secure HTML scripts, stylesheets, and preloads++Set a document-level `Referrer-Policy: strict-origin-when-cross-origin` HTTP response header (or include `<meta name="referrer" content="strict-origin-when-cross-origin">` in `<head>`) as a baseline default so any subresource or CSS `url()` that omits a per-request referrer modifier still strips sensitive path and query parameters on cross-origin requests.++Then, on external `<script>`, `<link rel="stylesheet">`, `<link rel="preload">`, and `<link rel="modulepreload">` elements, always set `integrity`, `crossorigin`, and `referrerpolicy` together:++- **`integrity="sha384-..."`**: Blocks execution or application of the resource if the response bytes do not match the expected digest (for a blocked `<link rel="stylesheet">`, `linkElement.sheet` remains `null` and an `error` event fires).+- **`crossorigin="anonymous"`** (recommended default for public CDN assets) or **`crossorigin="use-credentials"`**: Required whenever `integrity` is set on a cross-origin resource. Omitting `crossorigin` causes the browser to fetch the resource in `no-cors` mode (producing an opaque response that cannot be hash-verified) and block the resource.+- **`referrerpolicy="no-referrer"`** (recommended default for third-party CDNs) or **`referrerpolicy="strict-origin-when-cross-origin"`**: Overrides the document referrer policy to prevent leaking any origin or path information in the `Referer` request header to the third-party host.++```html+<!-- Document-level baseline referrer policy in <head> (or via Referrer-Policy HTTP header) -->+<meta name="referrer" content="strict-origin-when-cross-origin" />++<!-- External stylesheet with SRI, anonymous CORS, and no referrer -->+<link+ rel="stylesheet"+ href="https://cdn.example.com/[email protected]/styles.css"+ integrity="sha384-bs0EksOYBbU/g0IAHMXbSyH1Mgw83GKn+EZlSI+VE+zVchXmSbLwhVLrPzsOWnc5"+ crossorigin="anonymous"+ referrerpolicy="no-referrer"+/>++<!-- External script with SRI, anonymous CORS, and no referrer -->+<script+ src="https://cdn.example.com/[email protected]/bundle.min.js"+ integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"+ crossorigin="anonymous"+ referrerpolicy="no-referrer"+></script>+```++When fetching external subresources programmatically with `fetch()`, pass the matching `integrity`, `mode`, `credentials`, and `referrerPolicy` options (a digest mismatch rejects the promise with `TypeError`):++```javascript+const response = await fetch('https://cdn.example.com/[email protected]/manifest.json', {+ integrity: 'sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC',+ mode: 'cors',+ credentials: 'omit',+ referrerPolicy: 'no-referrer',+});+```++## 3. Secure CSS images, fonts, and imported stylesheets with `url()` modifiers++CSS `url()` request modifiers (`cross-origin()`, `referrer-policy()`, and `integrity()`) control the fetch mode, referrer header, and Subresource Integrity verification of CSS-loaded resources—including `background-image`, `content`, `mask-image`, `border-image-source`, `filter`, `@font-face` `src`, and `@import` rules—directly from CSS:++| Modifier function | Argument syntax & allowed values | Purpose |+|---|---|---|+| `cross-origin(<ident>)` | **Unquoted keyword**: `anonymous` (recommended default) or `use-credentials` | Fetches the CSS resource using CORS and controls whether credentials are sent. Always include alongside `integrity()` on cross-origin CSS resources. |+| `referrer-policy(<ident>)` | **Unquoted keyword**: `no-referrer` (recommended default for third-party assets), `strict-origin-when-cross-origin`, `origin`, `same-origin`, `strict-origin`, `origin-when-cross-origin`, `no-referrer-when-downgrade`, or `unsafe-url` | Overrides the document referrer policy for this specific CSS request. |+| `integrity("<string>")` | **Quoted string**: `"sha384-<base64>"` (or space-separated digests `"sha384-... sha384-..."`) | Verifies the fetched CSS resource against the expected cryptographic digest before rendering or applying it. |++Follow these CSS syntax and security rules when authoring `url()` modifiers:++- **Quote the URL string inside `url("...")`**: Request modifiers are only valid when the URL inside `url(...)` is a quoted `<string>` (unquoted URLs cannot use modifiers).+- **Specify each modifier type at most once per `url()`**: You can combine `cross-origin()`, `referrer-policy()`, and `integrity()` in any order inside `url("..." ...)`, but repeating the same modifier type twice (such as two `integrity()` modifiers) is invalid. To supply multiple hashes, space-separate them inside a single `integrity("sha384-... sha384-...")` string.+- **Always pair cross-origin `integrity()` with `cross-origin(anonymous)`**: While `@font-face` `src` and `mask-image` already fetch in anonymous `cors` mode by default, `background-image`, `content`, `border-image-source`, and `@import` default to `no-cors` mode (producing an opaque response that cannot be hash-verified) and external SVG `filter` defaults to `same-origin` mode (blocking cross-origin URLs outright). Including `cross-origin(anonymous)` (or `cross-origin(use-credentials)`) ensures consistent CORS verification across every CSS property.+- **Place modifiers inside `url("...")` in `@import` and `@font-face` rules**: Keep `cross-origin()`, `referrer-policy()`, and `integrity()` inside `url("..." ...)`, while keeping font descriptors like `format("woff2")` and `tech(...)` outside `url(...)`.++```css+@import url(+ "https://cdn.example.com/[email protected]/tokens.css"+ cross-origin(anonymous)+ referrer-policy(no-referrer)+ integrity("sha384-bs0EksOYBbU/g0IAHMXbSyH1Mgw83GKn+EZlSI+VE+zVchXmSbLwhVLrPzsOWnc5")+);++@font-face {+ font-family: "BrandSans";+ src: url(+ "https://cdn.example.com/[email protected]/brand-sans.woff2"+ cross-origin(anonymous)+ referrer-policy(no-referrer)+ integrity("sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC")+ ) format("woff2");+ font-display: swap;+}++.verified-graphic {+ background-image: url(+ "https://cdn.example.com/[email protected]/badge.svg"+ cross-origin(anonymous)+ referrer-policy(no-referrer)+ integrity("sha384-Iw/0p59dP96nGTzHvf2XIfqcBwBW7RM6JfOij8uZxyg5azfNaOOUW8SQy6H/hU91")+ );+}+```++## Fallback strategies++Browser support for cross-origin() for url(): Limited availability.+Supported by: Chrome 150 (Jun 2026), Edge 150 (Jul 2026), and Safari 26.2 (Dec 2025).+Unsupported in: Firefox.++Browser support for referrer-policy() for url(): Limited availability.+Supported by: Chrome 150 (Jun 2026), Edge 150 (Jul 2026), and Safari 26.2 (Dec 2025).+Unsupported in: Firefox.++Browser support for integrity() for url(): Limited availability.+Supported by: Chrome 150 (Jun 2026) and Edge 150 (Jul 2026).+Unsupported in: Firefox and Safari.++If your Baseline target does not yet support CSS `url()` request modifiers (`cross-origin()`, `referrer-policy()`, or `integrity()`), combine document-level policies with cascading CSS declarations so subresources remain functional and protected:++1. **Prefer HTML `<link rel="stylesheet">` over CSS `@import` when cross-browser SRI is required**: Because `subresource-integrity` and `referrer-policy` on `<link rel="stylesheet">` are widely available across all browsers, load external stylesheets with `<link rel="stylesheet" href="..." integrity="sha384-..." crossorigin="anonymous" referrerpolicy="no-referrer">` instead of `@import` whenever integrity verification must be enforced in every browser.+2. **Rely on the document-level `Referrer-Policy` header or `<meta name="referrer">` from Step 2**: In browsers that do not support `referrer-policy()` inside CSS `url()`, the document-level `Referrer-Policy: strict-origin-when-cross-origin` header or `<meta name="referrer" content="strict-origin-when-cross-origin">` element automatically strips sensitive path and query parameters on cross-origin CSS requests.+3. **Cascade separate CSS declarations for progressive enhancement**: Browsers that do not recognize a modifier inside `url("..." ...)` discard the entire declaration at CSS parse time. Declare a plain `url("...")` first, followed by a `cross-origin()` and `referrer-policy()` declaration (for browsers that support those two modifiers but not `integrity()`), followed by the full declaration including `integrity("sha384-...")`:+ - **Never put an unverified `url()` inside the same comma-separated `@font-face` `src` list**: Writing `src: url("font.woff2" cross-origin(anonymous) integrity("sha384-...")), url("font.woff2");` in a single `src` descriptor bypasses Subresource Integrity at runtime—if a CDN serves a tampered font that fails the `integrity()` check, the browser treats it as a load failure and automatically falls back to the second comma-separated `url("font.woff2")`. Using **separate** `src:` declarations ensures supporting browsers overwrite the unverified declaration at CSS parse time and block tampered fonts at runtime.++```css+@font-face {+ font-family: "BrandSans";+ /* 1. Parse-time fallback for browsers without url() modifier support */+ src: url("https://cdn.example.com/[email protected]/brand-sans.woff2") format("woff2");+ /* 2. Parse-time fallback for browsers supporting cross-origin() and referrer-policy() */+ src: url(+ "https://cdn.example.com/[email protected]/brand-sans.woff2"+ cross-origin(anonymous)+ referrer-policy(no-referrer)+ ) format("woff2");+ /* 3. Full protection in browsers supporting cross-origin(), referrer-policy(), and integrity() */+ src: url(+ "https://cdn.example.com/[email protected]/brand-sans.woff2"+ cross-origin(anonymous)+ referrer-policy(no-referrer)+ integrity("sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC")+ ) format("woff2");+ font-display: swap;+}++.verified-graphic {+ background-image: url("https://cdn.example.com/[email protected]/badge.svg");+ background-image: url(+ "https://cdn.example.com/[email protected]/badge.svg"+ cross-origin(anonymous)+ referrer-policy(no-referrer)+ );+ background-image: url(+ "https://cdn.example.com/[email protected]/badge.svg"+ cross-origin(anonymous)+ referrer-policy(no-referrer)+ integrity("sha384-Iw/0p59dP96nGTzHvf2XIfqcBwBW7RM6JfOij8uZxyg5azfNaOOUW8SQy6H/hU91")+ );+}+```++4. **Feature-detect CSS `url()` modifier support in JavaScript with `CSS.supports()`**:++```javascript+export function getCssUrlModifierSupport() {+ const supportsCrossOriginAndReferrer =+ typeof CSS !== 'undefined' &&+ typeof CSS.supports === 'function' &&+ CSS.supports(+ 'background-image',+ 'url("https://example.com/a.svg" cross-origin(anonymous) referrer-policy(no-referrer))',+ );++ const supportsUrlIntegrity =+ typeof CSS !== 'undefined' &&+ typeof CSS.supports === 'function' &&+ CSS.supports(+ 'background-image',+ 'url("https://example.com/a.svg" cross-origin(anonymous) referrer-policy(no-referrer) integrity("sha384-Iw/0p59dP96nGTzHvf2XIfqcBwBW7RM6JfOij8uZxyg5azfNaOOUW8SQy6H/hU91"))',+ );++ return { supportsCrossOriginAndReferrer, supportsUrlIntegrity };+}+```diff --git a/skills/modern-web-guidance/guides/security/security.md b/skills/modern-web-guidance/guides/security/security.mdindex c1c5973..4b6f839 100644--- a/skills/modern-web-guidance/guides/security/security.md+++ b/skills/modern-web-guidance/guides/security/security.md@@ -213,7 +213,7 @@ HTML for nonce-based CSP:```**Server / Middleware Per-Request Nonce Generation:**-In server-rendered or SSR middleware (such as Node.js, Express, or Astro middleware), generate a fresh cryptographic nonce on every request, attach it to `Content-Security-Policy`, and stamp `nonce` onto `<script>` tags in HTML responses:+In server-rendered or SSR middleware (such as Node.js, Express, or Astro middleware), generate a fresh cryptographic nonce on every request, attach it to `Content-Security-Policy`, and pass the nonce into your template/SSR rendering context so only trusted template `<script>` tags receive it:```javascriptconst bytes = new Uint8Array(16);@@ -232,13 +232,16 @@ const csp = [headers.set('Reporting-Endpoints', 'main-endpoint="https://reports.example/main"');headers.set('Content-Security-Policy', csp);-// If transforming rendered HTML in middleware, inject the per-request nonce onto <script> tags:-html = html.replace(/<script\b(?![^>]*\bnonce=)/gi, `<script nonce="${nonce}"`);+// Pass the per-request nonce into your template/SSR rendering context (or replace an+// explicit placeholder token in a static template before interpolating any user data):+res.locals.nonce = nonce; // e.g., <script nonce="<%= nonce %>" src="/app.js"></script>```For static/cached HTML (SPAs) where a per-response nonce is not possible, use hash-based CSP: compute the `sha256-` hash of each script and list the hashes in `script-src` alongside `'strict-dynamic' 'report-sample'`.-**Avoid**: Broad scheme or domain allowlists (such as `https:` alone or `script-src https://cdn.example.com` without `'strict-dynamic'`) as the primary `script-src` protection — they are easily bypassed by open redirects, JSONP endpoints, and dependency injection on the allowed origin.+**Avoid**:+- Broad scheme or domain allowlists (such as `https:` alone or `script-src https://cdn.example.com` without `'strict-dynamic'`) as the primary `script-src` protection — they are easily bypassed by open redirects, JSONP endpoints, and dependency injection on the allowed origin.+- Rewriting already-rendered HTML with a regular expression (such as `html.replace(/<script\b.../gi, ...)`) to stamp CSP nonces onto every `<script>` tag — post-processing rendered HTML cannot distinguish developer-authored `<script>` tags from untrusted `<script>` tags introduced via reflected or stored HTML injection, authorizing attacker-injected scripts under `script-src 'nonce-...'`.#### 3.3 Trusted Types EnforcementTrusted Types enforces source-level guidance at runtime by blocking raw string assignments to dangerous DOM XSS sinks (`innerHTML`, `outerHTML`, `document.write`, `script.src`, `script.textContent`) unless they pass through a named policy.@@ -349,12 +352,12 @@ Permissions-Policy: camera=(), geolocation=(), microphone=(), focus-without-user```#### Subresource Integrity (SRI)-- **DO**: Use the `integrity` attribute with a cryptographic hash (preferring `sha256` or `sha512`) when loading third-party scripts, combined with `crossorigin="anonymous"`.+- **DO**: Use the `integrity` attribute with a cryptographic hash (preferring `sha384`, `sha512`, or `sha256`) when loading third-party scripts and stylesheets, combined with `crossorigin="anonymous"` (see `secure-external-subresources` (via `npx -y modern-web-guidance@latest retrieve "secure-external-subresources"`) for securing HTML and CSS subresources with SRI, CORS, and Referrer Policy).- **DO**: Ensure the server/CDN sends an appropriate `Access-Control-Allow-Origin` header so the browser can compute the hash.- **DO NOT**: Use SRI for dynamic or unversioned assets — silent updates will cause script execution to fail. SRI is strictly for immutable, versioned assets.```html-<script src="https://cdn.example.com/lib.js" integrity="sha256-H8df...39v" crossorigin="anonymous"></script>+<script src="https://cdn.example.com/[email protected]" integrity="sha384-oqVu...Y8wC" crossorigin="anonymous"></script>```#### Cross-Origin Resource Sharing (CORS)diff --git a/skills/modern-web-guidance/guides/security/trusted-types.md b/skills/modern-web-guidance/guides/security/trusted-types.mdindex 99e01df..41e6364 100644--- a/skills/modern-web-guidance/guides/security/trusted-types.md+++ b/skills/modern-web-guidance/guides/security/trusted-types.md@@ -26,8 +26,21 @@ const myPolicy = trustedTypes.createPolicy('sanitize-html', {// Example using DOMPurify:DOMPurify.sanitize(input, { RETURN_TRUSTED_TYPE: false }),});++// Example using HTML escaping (for environments without third-party sanitizers):+const escapePolicy = trustedTypes.createPolicy('escape-html', {+ createHTML: (input) =>+ String(input)+ .replaceAll('&', '&')+ .replaceAll('<', '<')+ .replaceAll('>', '>')+ .replaceAll('"', '"')+ .replaceAll("'", '''),+});```+> **Warning:** Character-level HTML escaping (`escapePolicy`) converts all markup into plain text and is **not** a context-aware HTML sanitizer. If you only need plain text, prefer `element.textContent` (which is not a Trusted Types sink). Never interpolate `escapePolicy.createHTML()` output into another HTML template string—such as an unquoted attribute (`<img src=${escaped}>`) or a URL attribute (`<a href="${escaped}">`, where `javascript:` URLs are not neutralized by entity escaping). Use a full HTML sanitizer (`DOMPurify` or `element.setHTML()`, covered in `sanitize-untrusted-html` (via `npx -y modern-web-guidance@latest retrieve "sanitize-untrusted-html"`)) whenever accepting HTML markup or attributes.+### 2. Using the PolicyInstead of passing a string directly to a sink, you call the policy's creation method.@@ -89,10 +102,10 @@ Trusted Types should be rolled out incrementally to avoid breaking your applicatContent-Security-Policy: require-trusted-types-for 'script';```-You can also restrict which policies are allowed to be created (include `dompurify` if your policy delegates to `DOMPurify.sanitize()`, which internally creates a `dompurify` policy, and `default` if you register a default policy during migration):+You can also restrict which policies are allowed to be created (list your policy names such as `sanitize-html` or `escape-html`, include `dompurify` if your policy delegates to `DOMPurify.sanitize()`—which internally creates a `dompurify` policy—and include `default` if you register a default policy during migration):```http-Content-Security-Policy: require-trusted-types-for 'script'; trusted-types sanitize-html dompurify;+Content-Security-Policy: require-trusted-types-for 'script'; trusted-types sanitize-html escape-html dompurify;```With this CSP in place, any writes to a sink that don't use Trusted Types will throw an error. In addition, attempting to create a Trusted Type policy with a name not listed in `trusted-types` will throw an error.@@ -103,7 +116,7 @@ You can also set this CSP as a `<meta>` tag in your document's `<head>`, althoug<!-- First child of `<head>`, as earlier tags will not enforce this CSP. --><metahttp-equiv="Content-Security-Policy"- content="require-trusted-types-for 'script'; trusted-types sanitize-html dompurify;"+ content="require-trusted-types-for 'script'; trusted-types sanitize-html escape-html dompurify;"/>```diff --git a/skills/modern-web-guidance/guides/ui-atoms/position-aware-tooltips.md b/skills/modern-web-guidance/guides/ui-atoms/position-aware-tooltips.mdindex a5a2430..0bcf055 100644--- a/skills/modern-web-guidance/guides/ui-atoms/position-aware-tooltips.md+++ b/skills/modern-web-guidance/guides/ui-atoms/position-aware-tooltips.md@@ -14,7 +14,7 @@ By setting `container-type: anchored` on your positioned element, you turn it in### 1. Create the tooltip and trigger-Use the Popover API to create a tooltip. This creates an implicit anchor connection that can be used for positioning.+Use the Popover API to create a tooltip. Invoking the popover via `popovertarget` automatically establishes an **implicit anchor connection** with the trigger button, so no explicit `anchor-name` or `position-anchor` is required.```html<button popovertarget="tooltip" id="anchor" aria-describedby="tooltip">anchor</button>diff --git a/skills/modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.md b/skills/modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.mdindex ae04738..e193524 100644--- a/skills/modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.md+++ b/skills/modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.md@@ -23,7 +23,7 @@ The first step is to create a trigger button that opens the overlay container us</div>```-This creates an *implicit* anchor association between the button and the panel, so that the panel can be positioned relative to the button.+This creates an *implicit* anchor association between the button and the panel, so that the panel can be positioned relative to the button natively without needing `anchor-name` on the button or `position-anchor` on the panel.### 2. Positioning with `position-area`@@ -104,7 +104,7 @@ Without a bundler, import from a CDN inside a `<script type="module">`:Alternatively, for a legacy fallback without a polyfill, use `position: fixed` and manually calculate coordinates via `getBoundingClientRect()` or rely on default positioning with `inset: auto` if that's acceptable for the use case.Browser support for Anchor positioning: Limited availability.-Supported by: Safari 27.+Supported by: Safari 27 (Sep 2026).Unsupported in: Chrome, Edge, and Firefox.To support browsers without anchor positioning, you must set a reasonable position. By default popovers are centered in the middle of the screen, which may work for your use case.diff --git a/skills/modern-web-guidance/guides/ui-behaviors/2d-panning.md b/skills/modern-web-guidance/guides/ui-behaviors/2d-panning.mdindex 8cd4f59..796ef73 100644--- a/skills/modern-web-guidance/guides/ui-behaviors/2d-panning.md+++ b/skills/modern-web-guidance/guides/ui-behaviors/2d-panning.md@@ -71,7 +71,7 @@ Because a 2D panning surface often lacks focusable child controls (for example,## Fallback strategiesBrowser support for scroll-axis-lock: Limited availability.-Supported by: Chrome 153.+Supported by: Chrome 153 (Sep 2026).Unsupported in: Edge, Firefox, and Safari.Choose between **progressive enhancement** and a **JavaScript fallback** based on your application's requirements:diff --git a/skills/modern-web-guidance/guides/ui-behaviors/anchor-positioning-tab-underline.md b/skills/modern-web-guidance/guides/ui-behaviors/anchor-positioning-tab-underline.mdindex 7048296..31ef4b1 100644--- a/skills/modern-web-guidance/guides/ui-behaviors/anchor-positioning-tab-underline.md+++ b/skills/modern-web-guidance/guides/ui-behaviors/anchor-positioning-tab-underline.md@@ -84,7 +84,7 @@ This is only a visual indicator, and must not be a replacement for setting the a## Fallback strategiesBrowser support for Anchor positioning: Limited availability.-Supported by: Safari 27.+Supported by: Safari 27 (Sep 2026).Unsupported in: Chrome, Edge, and Firefox.If anchor positioning is not supported in the browser, use a `border-bottom` to add an underline. It will not be animated.diff --git a/skills/modern-web-guidance/guides/ui-behaviors/custom-button-actions.md b/skills/modern-web-guidance/guides/ui-behaviors/custom-button-actions.mdindex f9996f1..f9c7b5e 100644--- a/skills/modern-web-guidance/guides/ui-behaviors/custom-button-actions.md+++ b/skills/modern-web-guidance/guides/ui-behaviors/custom-button-actions.md@@ -76,6 +76,13 @@ const commandRegistry = {* **Shadow roots**: If the target may be in a shadow root, use `event.composedPath()[0]` instead of `event.target`.* **Accessibility**: Custom commands have no inherent semantics, and you must explicitly apply any states.+## Accessibility considerations++* If the button displays additional content, use the `aria-expanded` attribute, set to `aria-expanded="false"` by default and `aria-expanded="true"` when the accompanying content is displayed+* If the button facilitates an interaction itself (examples include toggle buttons which can play and pause, volume buttons which can mute and unmute), use the `aria-pressed` attribute, set to `aria-pressed="false"` when inactive, and `aria-pressed="true"` when active+* If the button opens an element with a role of either `menu`, `listbox`, `tree`, `grid`, or `dialog`, then the control must have an `aria-haspopup` attribute, with a value set to the role of the element that it opens+* If the button becomes disabled on activation, instead of using `disabled`, use `aria-disabled="true"` so that there is no loss of focus+## Fallback strategiesBaseline status for Invoker commands: Newly available. It's been Baseline since 2025-12-12.diff --git a/skills/modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.md b/skills/modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.mdindex fe4145a..fe2f660 100644--- a/skills/modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.md+++ b/skills/modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.md@@ -45,32 +45,19 @@ Even with `interestfor` handling the semantics above, your implementation MUST s### Positioning the tooltip-The tooltip can be positioned using anchor positioning. When the tooltip is opened using `interestfor`, the trigger becomes an implicit anchor for the tooltip, meaning you don't have to add `anchor-name` or `position-anchor` CSS properties. However, to support browsers without anchor positioning you must use the anchor positioning polyfill, which has several limitations for popovers. **MANDATORY:** Implicit anchors are NOT supported by the polyfill, so YOU MUST explicitly set an `anchor-name` on the trigger and `position-anchor` on the popover.+The tooltip is positioned using **CSS Anchor Positioning**. When the tooltip is opened using `interestfor`, the trigger element automatically becomes an **implicit anchor** for the popover.+In modern browsers supporting native anchor positioning, you do **not** need to define an `anchor-name` on the trigger or a `position-anchor` on the tooltip. You can position the tooltip directly relative to its implicit anchor using `position-area` and handle collision flipping with `position-try-fallbacks`:```css-/* MANDATORY: use explicit anchor names for compatibility with the polyfill */-button[interestfor="tooltip-dom"] {- anchor-name: --tooltip-dom;-}-#tooltip-dom {- position-anchor: --tooltip-dom;-}-```--Also, the polyfill does not support `position-area` on popovers, so **MANDATORY:** DO position using `anchor()` functions, and **YOU MUST** include a `position-try` fallback (e.g. `flip-block` or `flip-inline`).--```css-[popover]{- /* MANDATORY: use anchor functions and a position-try fallback for the polyfill */- top: anchor(bottom);- left: anchor(center);- position-try: flip-block;+[popover] {+ /* Implicit anchor from interestfor: no anchor-name or position-anchor needed */+ position-area: top;+ position-try-fallbacks: flip-block;margin: unset;}```-### Fallback strategies### Fallbacks & browser support for Interest invokers@@ -161,10 +148,12 @@ Unsupported in: Safari.The `popover-polyfill` does not polyfill the hint behavior in browsers that support `popover` but not `popover="hint"`. For those browsers, a tooltip opened via focus may stay open when a second tooltip opened via hover.Browser support for Anchor positioning: Limited availability.-Supported by: Safari 27.+Supported by: Safari 27 (Sep 2026).Unsupported in: Chrome, Edge, and Firefox.-**MANDATORY:** To support browsers without anchor positioning, you MUST use the `@oddbird/css-anchor-positioning` polyfill. It does not support implicit anchors, so you MUST add anchor names to the trigger. Additionally, `position-area` is not supported on popovers by the polyfill, so you MUST use `anchor()` on the desired insets.+To support browsers without anchor positioning, you can use the `@oddbird/css-anchor-positioning` polyfill. Alternatively, you can use `@supports` to specify a fallback position.++When using the `@oddbird/css-anchor-positioning` polyfill for legacy browser support, be aware that the polyfill does not support implicit anchors or `position-area` on popovers. Explicitly set an `anchor-name` on the trigger, set `position-anchor` on the popover, and position using `anchor()` inset functions instead of `position-area`:```html<!-- MANDATORY: Conditionally install the anchor positioning polyfill -->diff --git a/skills/modern-web-guidance/guides/ui-components/card.md b/skills/modern-web-guidance/guides/ui-components/card.mdnew file mode 100644index 0000000..81fb973--- /dev/null+++ b/skills/modern-web-guidance/guides/ui-components/card.md@@ -0,0 +1,132 @@+# Build a Card++## Overview++A card groups one related piece of content or one choice. It is a visual pattern, not a fixed semantic or interaction model, so preserve the content's meaning and use the native interaction that matches its purpose.++## Guidelines++Choose semantics for the content and its interaction separately:++- use `<article>` as the card root, whether or not it links to a destination;+- use a native link for navigation. When the whole card is one destination, a single link may wrap the `<article>` only if the card contains no other interactive elements (`a`, `button`, `input`, `select`, `textarea`);+- keep links and buttons for independent actions as separate native controls;+- use a radio button or checkbox with an associated `<label>`, or an `option` in a native `<select>`, when the card is a choice.++Keep media, title, supporting content, and actions in meaningful source order; don't use CSS `order` to contradict it (see `css-layout` (via `npx -y modern-web-guidance@latest retrieve "css-layout"`)).++## Implementation++Keep the markup minimal and let CSS selectors recognize each region, so simple cards stay simple and richer cards stay possible. A card has up to four regions, in this source order, and any of them can be omitted. Regions are direct children of the card, not grouped in wrapper elements such as `.card__body`, which prevents placing and styling regions by selector. A region with a single element is that element itself, not wrapped: a lone paragraph is the `<p>`. Use a wrapper only when a region holds multiple elements.++- **Media**: an `<img>`, `<picture>`, `<video>`, or `<svg>` as the first child. Add a `.media` class only to arbitrary hero content that is not one of those elements, and never wrap a plain `<img>` in a `.media` element.+- **Header**: a heading on its own. Use `<hgroup>` only when the heading has a subtitle or tagline, and `<header>` when the region carries more than a title, such as a byline or badge. When the card has a primary destination, the link goes inside the heading.+- **Content**: a single `<p>`, `<ul>`, or `<dl>` stands on its own. When the content is several elements, such as multiple paragraphs or a paragraph plus a list, group them in one `<div>` so the region is a single grid item.+- **Footer**: a `<footer>` holding independent actions as native links and buttons. A "read more" link may share the heading link's URL, but give it a descriptive accessible name that starts with the visible text, using visually hidden text (for example, `Read more<span> about poached eggs</span>`), because identical "read more" links are ambiguous in a screen reader's link list. Don't add other footer links that repeat the heading's URL.++The simplest card is an `<article>` containing a heading and a paragraph. Choose the link and action pattern that matches the card's behavior; see [Interaction models](#interaction-models).++For card images or video that should fill a fixed-ratio area, set `aspect-ratio` and `object-fit: cover` on the `<img>` or `<video>` itself, so it fills the area without distortion (cropping may occur). Use a `.media` container's `aspect-ratio` only for other hero content. Otherwise, preserve the media's intrinsic ratio. Give informative images an appropriate text alternative; use `alt=""` for decorative images.++### Adapt to available space++Base the layout on the card's available space, not the viewport. To adapt the card's descendants (media, text, actions), make the card the size container (`container-type: inline-size`) and write `@container` rules against its children. Avoid sizing from the grid or list parent: the card's actual width can depend on column count, gaps and so on, making parent-based breakpoints are noisy.++In a narrow container, stack the regions in source order. In a wide container, place the media in a side column beside the other regions, but only for cards that have media: scope those rules with `:has()` on the media child (for example `.card:has(> img)`) so the column definitions and `grid-column` placements never apply to a card without media. A card without media stays single-column at every width, and must not reserve an empty media column.++### Align cards in a grid++When cards in a row should share the heights of their regions, use `subgrid`: make each card span four shared row tracks (media, header, content, footer) and place regions by element selector, treating everything that is not media, a heading, or a `<footer>` as content. A card that omits a region leaves its track empty, so the remaining regions still line up with neighboring cards. Each track holds one grid item, so wrap the content region in a `<div>` only when it has more than one element and cards share tracks. Cards that are not aligned with siblings need neither wrapper nor subgrid.++## Interaction models++### Content cards++Use an `<article>` as the card root. Keep links and buttons as separate native controls.++### Single-destination cards++When the whole card is one destination and has no independent actions, use one native link. The link can wrap the `<article>`. Do not nest other links, buttons, or form controls inside the link, and keep any "read more" text a plain `<p>` or `<span>`. Because the link's accessible name is all of the card's text, keep the content short; if the card has a lot of text or other actions, use the stretched-link pattern below so only the heading is the link:++```html+<a href="/recipes/poached-eggs">+ <article class="card">+ <h3>Poached eggs</h3>+ <p>Two poached eggs served on toasted sourdough.</p>+ </article>+</a>+```++### Clickable cards with independent actions++If clicking the card triggers an action rather than navigating, use a `<button>` instead of a link.++When a content card links to a primary destination, also contains other interactive elements, and needs to be clickable as a whole:+- Use a single opt-in, on the primary link itself: put `.card-link` on exactly one link per card (the heading link). Footer and other links never get it, or each would stretch its own overlay and the last one would capture the whole card.+- Link its title and stretch the pointer hit area across the card with `::after`++```css+.card:has(a.card-link) {+ position: relative;+}++.card a.card-link::after {+ content: "";+ position: absolute;+ inset: 0;+}+```++- Elevate interactive elements with `position: relative; z-index: 1` so they remain operable. Target types of elements (e.g. `a, button`) rather than requiring opt-in via classes.+- Do NOT apply `z-index` to entire containers as that would make them capture pointer events that don't produce any action.++```css+.card:has(a.card-link) {+ /* Keep other interactive elements above the overlay */+ a:not(.card-link), button, input, x-button {+ position: relative;+ z-index: 1;+ }+}+```++- Style the card itself on hover/focus, rather than the stretched link:++```css+.card {+ a.card-link {+ &:focus-visible {+ outline: none; /* Draw it on the card instead */+ }+ }++ &:has(a.card-link:focus-visible) {+ /* Focus ring */+ }++ &:has(a.card-link:hover) {+ /* Hover styles */+ }+}++```++### Choice cards++For cards that represent predefined choices, use `<label class="card">` with a checkbox or radio as a direct child.++Style the selected card with `:has(:checked)`. Never change layout-affecting properties such as `border-width`, `padding`, or `font-weight` on selection, because the card and its neighbors jump; draw the emphasis with `outline`, `box-shadow`, or a transparent border that only changes color:++```css+.card {+ border: 2px solid transparent;++ &:has(> :checked) {+ border-color: var(--accent);+ }+}+```++The visible checkbox or radio is itself a non-color indicator of selection, so the color change alone is sufficient. If the control is visually hidden (keep it focusable and in the accessibility tree, never `display: none`), add a non-color indicator that does not affect layout, such as a check icon or a thicker `outline`.++When choices belong in a dropdown picker whose options are laid out as cards, use a native `<select>` with `appearance: base-select` and style `::picker(select)` and `<option>` elements rather than replacing the select with `<div>` cards; see `custom-select-picker-layouts` (via `npx -y modern-web-guidance@latest retrieve "custom-select-picker-layouts"`) for more details and fallbacks.diff --git a/skills/modern-web-guidance/guides/ui-components/dialog.md b/skills/modern-web-guidance/guides/ui-components/dialog.mdnew file mode 100644index 0000000..fbd3c21--- /dev/null+++ b/skills/modern-web-guidance/guides/ui-components/dialog.md@@ -0,0 +1,226 @@+# Dialog++## Overview++Use the native `<dialog>` element for modal and non-modal dialogs. It provides the accessibility semantics, focus handling, top-layer rendering and `Esc` handling that custom overlays have to rebuild by hand.++## Choose the overlay type++Pick the first rule that matches. If unsure, use Rule 1.++### Rule 1: The overlay interrupts the user and blocks the page (default)++Use for confirmations, forms, sign-in, destructive actions, and any "modal", "dialog", "lightbox" or "popup" request that does not say otherwise.++Use `<dialog>` opened as a modal, declaratively with `command="show-modal"` (see `declarative-dialog-popover-control` (via `npx -y modern-web-guidance@latest retrieve "declarative-dialog-popover-control"`)) or from script with `showModal()`.++```html+<button type="button" command="show-modal" commandfor="confirm">Delete</button>++<!-- MANDATORY: no role="dialog" or aria-modal; the native modal already provides them -->+<dialog id="confirm" aria-labelledby="confirm-title">+ <h2 id="confirm-title">Delete this item?</h2>+ <form method="dialog">+ <button value="cancel" autofocus>Cancel</button>+ <button value="delete">Delete</button>+ </form>+</dialog>+```++The browser provides: inert page, focus containment, top layer, `::backdrop`, `Esc` and back-gesture dismissal, and focus return to the invoker.++- **DON'T** add `role="dialog"`, `aria-modal`, a focus trap, `inert` toggling or an `Esc` handler.+- **DON'T** open it with `show()` or the `open` attribute.+- **DO** stop the page scrolling behind it with the CSS below. See `prevent-page-scroll-under-modal-dialog` (via `npx -y modern-web-guidance@latest retrieve "prevent-page-scroll-under-modal-dialog"`) for the details.+- **DON'T** lock scrolling with `overflow: hidden` or `position: fixed` on `html` or `body`.++```css+/* MANDATORY (both rules): without them, scrolling over the backdrop or inside the dialog scrolls the page behind it */+dialog:modal {+ overscroll-behavior: contain; /* stops scroll gestures in the dialog chaining to the page */+}+dialog::backdrop {+ overflow: hidden; /* ::backdrop is not a scroll container by default, so it would ignore overscroll-behavior */+ overscroll-behavior: contain;+}+```++Not for menus or tooltips: see Rule 3.++### Rule 2: The user keeps working in the page while the panel is open++Use for find bars, inspectors, palettes and compose panes that are still dialogs semantically.++Use `<dialog popover>` for a top-layer panel with popover dismissal (`auto` light-dismisses, `manual` does not). Use `dialog.show()` only when the panel must not be in the top layer.++```html+<button type="button" popovertarget="find">Find</button>+<dialog id="find" popover="manual" aria-labelledby="find-title">+ <h2 id="find-title">Find</h2>+ <input type="search" aria-label="Search">+ <button type="button" popovertarget="find" popovertargetaction="hide">Close</button>+</dialog>+```++The page stays interactive and is not made inert.++- **DO** include a visible close button.+- **DON'T** use `showModal()`, which blocks the page.++Not for blocking confirmations: see Rule 1.++### Rule 3: The overlay is not a dialog++Use for menus, dropdowns, tooltips, hovercards and toasts.++Use a semantic element with the `popover` attribute, not `<dialog>`.++```html+<button type="button" popovertarget="menu">Actions</button>+<ul id="menu" popover>+ <li><a href="/rename">Rename</a></li>+</ul>+```++## Choose how it can be dismissed++The default depends on how the dialog is opened. If `closedby` is absent or invalid, `showModal()` behaves as `closerequest` and any other way of opening behaves as `none`.++- **Esc and back gesture only (modal default):** set nothing, or `closedby="closerequest"`.+- **Also click outside to close:** use `closedby="any"`.+- **Only the developer closes it (for example a form with unsaved changes):** use `closedby="none"` and add a confirmation path. See Closing below.++## Guidelines++### Accessible name and initial focus++- **DO** name every dialog with `aria-labelledby` pointing at its heading, or `aria-label` when there is no visible title.+- **DO** put `autofocus` on the primary control or first field.+- **DO** put `autofocus` on the safe action (such as Cancel or Keep) in a destructive confirmation.+- **DON'T** write code to return focus on close. The browser returns it to the invoker.++### Opening++- **DO** open declaratively with `command="show-modal"` and `commandfor` on a `<button>`. See `declarative-dialog-popover-control` (via `npx -y modern-web-guidance@latest retrieve "declarative-dialog-popover-control"`).+- **DO** use `dialog.showModal()` when opening from script.++### Closing++- **DO** close with `<form method="dialog">` buttons or `command="close"`.+- **DO** choose `closedby` deliberately: `any` (light dismiss and `Esc`), `closerequest` (`Esc` only, the modal default) or `none` (developer-controlled close only).+- **DO** use `command="request-close"` or `requestClose()` for Cancel buttons that must honor unsaved-changes logic. They fire `cancel` first and ignore `closedby`.+- **DO** treat `closedby` as progressive enhancement. `Esc` and the mobile back gesture already close modals without it.++### Hooking into close++- **DO** read `dialog.returnValue` in a `close` listener to learn which button was used, then reset it with `dialog.returnValue = ''`. `Esc` and other close requests set no value, and browsers differ on whether they clear the previous one, so without the reset a stale value can leak. Treat `''` as "dismissed without choosing".+- **DO** use `cancel` to intercept `Esc` and `request-close`, but do not rely on `preventDefault()` for repeated `Esc` presses without user activation.+- **DO** use `closedby="none"` with an explicit confirmation step for dirty forms.+- **DO** tell the user why the dialog stayed open when `cancel` is prevented: show a visible message and reference it with `aria-describedby` from the control that receives focus (such as Discard), so a screen reader reads it when focus moves. Without it, focus moving to a new button announces only that button's name.+- **DON'T** let the confirmation move controls under the pointer. Reserve the message's space (hide it with `visibility`, not `display` or `hidden`) and add the destructive button where existing buttons do not move (for example first in a right-aligned row), so a second click at the same spot cannot discard the user's changes.++### Non-modal dialogs++- **DO** use `<dialog popover>` (`auto` or `manual`) for a top-layer panel, and `dialog.show()` when you do not want the top layer.+- **DO** include a visible close button in every non-modal dialog.++### Backdrop and styling++- **DO** style `::backdrop` and use `dialog:modal` to target modal-only styles.+- **DO** leave animation to `animate-to-from-top-layer` (via `npx -y modern-web-guidance@latest retrieve "animate-to-from-top-layer"`), dragging to `drag` (via `npx -y modern-web-guidance@latest retrieve "drag"`), and reparenting to `persistent-top-layer-ui` (via `npx -y modern-web-guidance@latest retrieve "persistent-top-layer-ui"`).+- **DON'T** set `display` on `dialog` unconditionally. It overrides the closed state. Scope it with `dialog[open]`.++### Accessibility++- **DON'T** add `role="dialog"`, `aria-modal`, a manual focus trap or `inert` toggling to a native modal.+- **DO** use a native `<button>` with an accessible name for close controls.+- **DO** use one consistent heading level for dialog titles.++## Fallback strategies++### `closedby` (`dialog-closedby`)++Browser support for <dialog closedby>: Limited availability.+Supported by: Chrome 134 (Mar 2025), Edge 134 (Mar 2025), and Firefox 141 (Jul 2025).+Unsupported in: Safari.++Without `closedby`, a modal still closes with `Esc` and the back gesture; only click-outside is lost, so this is graceful degradation. `closedby="none"` is ignored the same way: `Esc` fires `cancel` and then closes the dialog. Keep the unsaved-changes guard in a `cancel` handler, not in `closedby="none"` alone, so it also protects where `closedby` is missing. If your Baseline target requires light dismiss, add this where `closedby` is missing:++```js+if (!('closedBy' in HTMLDialogElement.prototype)) {+ // Test the pointer position, not event.target: the <dialog> is also the target for its own+ // padding and the gaps between its children, so a target check would close on those clicks+ const outside = (e, dialog) => {+ const r = dialog.getBoundingClientRect();+ return e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom;+ };+ for (const dialog of document.querySelectorAll('dialog[closedby="any"]')) {+ let pressedOutside = false;+ dialog.addEventListener('pointerdown', (e) => { pressedOutside = outside(e, dialog); });+ // Require the press and the release outside, so a text-selection drag that ends on the backdrop does not dismiss+ dialog.addEventListener('pointerup', (e) => { if (pressedOutside && outside(e, dialog)) dialog.close(); });+ }+}+```++### `overscroll-behavior`++Browser support for overscroll-behavior: Limited availability.+Supported by: Chrome 144 (Jan 2026), Edge 144 (Jan 2026), and Firefox 150 (Apr 2026).+Unsupported in: Safari.++Treat scroll containment as progressive enhancement. Do not feature-detect it: `@supports` reports the property as supported even where non-scrollable containers ignore it. Where it is not enforced, the dialog still contains scroll whenever its own content overflows, and `showModal()` still makes the page inert. Do not fall back to `overflow: hidden` or `position: fixed` on `html` or `body`, which removes the root scrollbar and shifts the layout.++### Invoker Commands (`command` / `commandfor`)++Baseline status for Invoker commands: Newly available. It's been Baseline since 2025-12-12.+Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), Firefox 144 (Oct 2025), and Safari 26.2 (Dec 2025).++If your Baseline target does not include Invoker Commands, keep the same markup and conditionally load the polyfill (the same experience, as progressive enhancement). Detect on the interface and never load it unconditionally:++```js+// MANDATORY: feature detect on HTMLButtonElement.prototype and load only when native support is missing+if (!('commandForElement' in HTMLButtonElement.prototype)) {+ import('invokers-polyfill'); // npm install invokers-polyfill+}+```++Only Rules 2 and 3 use Popover.++### Fallbacks & browser support for Popover++Baseline status for Popover: Newly available. It's been Baseline since 2025-01-27.+Supported by: Chrome 116 (Aug 2023), Edge 116 (Aug 2023), Firefox 125 (Apr 2024), Safari 17 (Sep 2023), and Safari iOS 18.3 (Jan 2025).++The Popover API is mostly **progressive enhancement**, but its defining behaviors — top-layer promotion, light-dismiss, and `popovertarget` invocation — have no CSS-only equivalent. Older browsers need a polyfill, or a manual fallback if you would rather not ship one.++**Polyfill:** To support the `popover` attribute in older browsers, conditionally load [`@oddbird/popover-polyfill`](https://github.com/oddbird/popover-polyfill). **MANDATORY:** Feature detect by checking for the `popover` property on `HTMLElement.prototype`, and load the polyfill **only** when native support is missing — do NOT load it unconditionally.++With a bundler or import map:++```js+// MANDATORY: Feature detect 'popover' on HTMLElement.prototype.+if (!("popover" in HTMLElement.prototype)) {+ import("@oddbird/popover-polyfill");+}+```++Without a bundler, import from a CDN inside a `<script type="module">`:++```html+<script type="module">+ if (!("popover" in HTMLElement.prototype)) {+ import("https://unpkg.com/@oddbird/popover-polyfill@latest/dist/popover.min.js");+ }+</script>+```++**Styling caveat:** The polyfill cannot define the real `:popover-open` pseudo-class, so it applies a `.\:popover-open` class instead. **MANDATORY:** Combine the two with `:is()` or `:where()`, otherwise browsers that lack `:popover-open` discard the entire rule:++```css+[popover]:is(:popover-open, .\:popover-open) {+ display: block;+}+```++Alternatively, for a legacy fallback without a polyfill, use `position: fixed` and manually calculate coordinates via `getBoundingClientRect()` or rely on default positioning with `inset: auto` if that's acceptable for the use case.diff --git a/skills/modern-web-guidance/guides/ui-components/hovercard.md b/skills/modern-web-guidance/guides/ui-components/hovercard.mdindex ca1eb7a..47f08b1 100644--- a/skills/modern-web-guidance/guides/ui-components/hovercard.md+++ b/skills/modern-web-guidance/guides/ui-components/hovercard.md@@ -271,7 +271,7 @@ When using the polyfill, the CSS API changes slightly to account for the lack of```Browser support for Anchor positioning: Limited availability.-Supported by: Safari 27.+Supported by: Safari 27 (Sep 2026).Unsupported in: Chrome, Edge, and Firefox.Browser support for Cross-document view transitions: Limited availability.diff --git a/skills/modern-web-guidance/guides/ui-components/menu.md b/skills/modern-web-guidance/guides/ui-components/menu.mdnew file mode 100644index 0000000..94809f5--- /dev/null+++ b/skills/modern-web-guidance/guides/ui-components/menu.md@@ -0,0 +1,410 @@+<!-- Baseline best practices to be referenced by any guide that involves a popup menu (dropdown menus, context menus, overflow menus, etc)++Include:+- fixed-size icon slot (no subgrid)+- proper keyboard nav+- safe triangles for submenus+- converting to drawer on small screens?+-->++# Build a dropdown menu++This guide covers any popup menu: dropdown, context, overflow, and the menu bars that open them. The worked example is an application command menu, where items change the interface (create, save, preferences).++### Commands, links, and what makes a menu++Two independent choices. Everything else here applies to both.++* **Element, per item.** A command is a `<button type="button">`; a destination is an `<a href>` that still opens in a new tab, copies as a URL, and works without script. A dropdown may mix them freely: two links and six commands, or one command and six links, changes nothing below.+* **Interaction model, per dropdown.** Arrow keys, `Home`/`End`, and `Esc` make it a menu: add the focusgroup, let it infer `menuitem` on every item whether button or link, and make it look like one (a continuous bar or a trigger with a dropdown indicator; see "Menubar or separate menu buttons" below). A short list of links users `Tab` through is navigation: no focusgroup, no `role="menu"`, `role="menuitem"`, or `aria-haspopup="menu"`; keep the popover, `Esc`, and focus restoration, and see the navbar guide.++Content never decides the roles. A "Products" dropdown of links can be a menu; an "Account" dropdown of commands cannot be navigation.++Use the menu pattern only for a composite widget with one tab stop and arrow-key navigation. Use a `<div focusgroup="menu nomemory">`, not the HTML `<menu>` element. Do not add `role="menu"` or `role="menuitem"` in the shared markup: native focusgroup infers those roles, and explicit roles block that inference. Add them only in the unsupported-browser fallback below. `nomemory` makes reopening start at the first item. Focusgroup moves focus; script handles preview, activation, and focus restoration.++## Open and position the menu++Make each trigger a command invoker with `commandfor` and `command="toggle-popover"`. The browser opens and closes the popover on click, Enter, and Space, and keeps the trigger inside its popover's light-dismiss group, so clicking an open trigger closes it. Do not use `popovertarget` or `popovertargetaction`; this pattern uses `commandfor` instead.++Place each popover immediately after its trigger. Browsers add an implicit `aria-details` relationship only when the popover is not the next sibling, so this placement avoids it without extra attributes.++```html+<!-- Command invoker: the browser toggles the popover on click, Enter, and Space -->+<button id="file-trigger" class="trigger" type="button" aria-haspopup="menu" aria-expanded="false"+ commandfor="file-menu" command="toggle-popover">+ File+</button>+<!-- Immediately after its trigger, so browsers add no implicit aria-details -->+<div id="file-menu" popover="auto">+ <!-- Nested, not on the popover: Chromium otherwise drops focusgroup keyboard behavior -->+ <div focusgroup="menu nomemory" aria-labelledby="file-trigger">+ <button type="button">New file</button>+ <button type="button">Save</button>+ <button id="export-trigger" type="button" aria-haspopup="menu" aria-expanded="false"+ commandfor="export-menu" command="toggle-popover">+ Export <span aria-hidden="true">›</span>+ </button>+ <!-- Submenu: popover="auto" directly after its trigger, inside the parent focusgroup -->+ <div id="export-menu" popover="auto">+ <div focusgroup="menu nomemory" aria-labelledby="export-trigger">+ <button type="button">PDF</button>+ <button type="button">Plain Text</button>+ </div>+ </div>+ </div>+</div>+```++Name each menu with `aria-labelledby` pointing at its trigger. Keep decorative submenu indicators in CSS, or add `aria-hidden="true"`. Give triggers with `aria-expanded="true"` a visible active style so users can tell which menu is open or previewed.++### Menubar or separate menu buttons++Pick one form for the top-level triggers. Role, keyboard model, and styling must match: visually separate buttons signal one `Tab` stop each.++* **Menubar.** `role="menubar"` on the container (never on a popover), styled as one continuous bar with no gaps between triggers. One `Tab` stop; `ArrowLeft`/`ArrowRight` move between triggers; hover switches open menus. Use for an application command bar.+* **Separate menu buttons.** Each trigger is its own `Tab` stop and looks like a standalone button. No `role="menubar"`, no arrow keys between triggers, no preview on focus, no hover switching. Wrap in `<nav>` if they navigate, otherwise no role. Use for toolbars and page headers.++The rest of this guide describes the menubar form. For separate buttons, keep everything inside each menu and drop the menubar-level behavior.++### Position the menu with CSS Anchor Positioning++Use CSS anchor positioning, not JavaScript coordinates. Both `command="toggle-popover"` and `showPopover({ source: trigger })` set an implicit anchor, so do not add per-menu `anchor-name` or `position-anchor` rules. Menu behavior must not depend on anchor positioning.++```css+/* Top-level menus sit below their trigger. The implicit anchor comes from the invoker or source. */+[popover] {+ position-area: block-end span-inline-end;+ inset: auto;+}++/* A popover nested in another popover is a submenu: beside its parent item, flipping when it would overflow. */+[popover] [popover] {+ position-area: inline-end span-block-end;+ position-try-fallbacks: flip-inline, flip-block, --below;+}++/* Last resort for narrow viewports: directly below the trigger, indented, so the submenu never+ covers its trigger. */+@position-try --below {+ position-area: block-end span-inline-end;+ margin-inline-start: 1rem;+ /* Fit the area: the submenu's minimum width must not stop this fallback from fitting. */+ min-inline-size: 0;+ max-inline-size: calc(100% - 1rem);+}+```++Keep `--below` last so it applies only when neither side fits. It opens directly under the trigger, so on a narrow screen it covers the sibling items beneath the trigger; that is the accepted trade-off for staying next to the trigger. Also let the submenu shrink to the area (`min-inline-size: 0`, `max-inline-size` minus the indent). A fallback that does not fit is skipped, and if none fit the browser keeps the base placement, so a submenu that is a few pixels too wide silently covers its trigger.++For how the flip fallbacks work on a plain popover, see `viewport-aware-dropdowns` (via `npx -y modern-web-guidance@latest retrieve "viewport-aware-dropdowns"`). That guide positions a button group, not a menu; for menus, the submenu placement and `--below` fallback above take precedence.++### Animate open and close++Optional. Under 150 ms, `opacity` and a small `translate` only, same for submenus, inside `@media (prefers-reduced-motion: no-preference)`. Focus moves on `toggle`, so the transition never delays keyboard users.++```css+@media (prefers-reduced-motion: no-preference) {+ /* Closing: this rule is in effect once :popover-open is removed. */+ [popover] {+ opacity: 0;+ translate: 0 -.25rem;+ transition: opacity .15s, translate .15s, display .15s allow-discrete, overlay .15s allow-discrete;+ }+ /* Opening: faster. */+ [popover]:popover-open {+ opacity: 1;+ translate: 0 0;+ transition-duration: .1s;+ @starting-style { opacity: 0; translate: 0 -.25rem; }+ }+ /* Switching between open menubar menus is instant, as in native menubars. */+ [role="menubar"]:has(> [popover]:popover-open) > [popover] {+ transition: none;+ }+}+```++`@starting-style` is not a repeat of `[popover]`: a closed popover is `display: none`, and transitions do not run from an unrendered state, so it supplies the before-values for the open. Without it the open snaps and only the close animates. `display` and `overlay` with `allow-discrete` keep the popover rendered and in the top layer until the close transition ends.++## Keyboard and focus++Do not add a second roving-tabindex system inside a focusgroup. Script covers only what the invokers and focusgroup do not:++* **One tab stop for the menubar.** `Tab` enters at the first top-level trigger. `ArrowLeft` and `ArrowRight` move between top-level triggers and wrap at either end. `Home` and `End` on a trigger enter its menu at the first or last item.+ * **Note: which trigger `Tab` returns to.** The APG allows either the first trigger or the last one used. The guide specifies the first, but the demo moves the tab stop with `ArrowLeft` and `ArrowRight`, so after keyboard navigation `Shift`+`Tab` returns to the last trigger reached. Pointer use does not move it, so the same sequence can land on a different trigger. Either behavior is acceptable; pick one and keep it consistent.+* **Preview.** Focusing a top-level trigger shows its menu and sets `aria-expanded="true"`. Focus stays on the trigger, and no item is focused. Blurring the trigger closes a preview-only menu.+* **Enter and Space on a preview.** They close the preview and keep focus on the trigger. The native `toggle-popover` action handles this, so the script must not intercept these keys.+* **ArrowDown on a preview.** Converts it to an open menu and focuses the first item.+* **Pointer click on an open or previewed trigger.** Closes it natively; it does not enter the menu.+ * **Known difference on submenu triggers.** A pointer click on a submenu trigger also toggles natively, so it can close a submenu that hover already previewed, or open one that has not appeared yet. Native menus only open it and never close it. This is harmless, so the guide accepts it.+* **Pointer click on a closed trigger.** Opens it natively. Focus stays on the trigger; no item is focused. Only keyboard opens enter the menu.+* **Pointer over an item.** Focuses it without a ring, so hover and focus are one item.+* **Pointer over another top-level trigger while a menu is open.** Closes it and previews the hovered one, focusing its trigger without a ring. Nothing open: hover does nothing.+* **Pointer over a submenu trigger.** Previews its submenu after a short delay (pointer focus runs the same preview-on-focus). A sibling item closes it.+* **Within a menu.** `ArrowUp` and `ArrowDown` move between enabled items. `Home` and `End` move to the first and last enabled item, which the script handles.+* **ArrowLeft or ArrowRight in an open top-level menu.** Closes it and previews the adjacent menu with focus on its trigger, wrapping at either end. `ArrowDown` then enters it. Left and Right never land inside a menu.+* **ArrowRight on a submenu trigger.** Opens the submenu and focuses its first item.+* **ArrowRight on a submenu item without a child submenu.** Closes the hierarchy and previews the next top-level menu while focus stays on its trigger. `ArrowDown` then enters it.+* **ArrowLeft or Escape in a submenu.** Closes only that submenu and restores focus to its trigger. The parent menu stays open.+* **Enter or Space on a command.** Activates it and closes all open menus.+* **Tab.** Leaves the menu system. Do not trap focus or step through every command. Closing must not leave focus inside hidden content.++The `command` event fires before `toggle-popover` opens the menu, so focus cannot move into the menu there. Move focus in the `toggle` event instead. HTML restores focus only for the first `popover="auto"` in a stack, so nested levels must restore focus to their trigger explicitly.++## Implementing the interaction++Implement the behaviors above for your own markup. Arrow, `Home`/`End`, wrap-around and `Tab`-to-exit handling is ordinary `keydown` code. A few parts are easy to get wrong, grouped below by input type.++### Keyboard and focus handling++1. **One open path.** Opening by keyboard calls `trigger.click()`, so the invoker's `toggle-popover` is the only way a menu opens. Mark the menu so the `toggle` handler enters it, keyboard opens only. On a pointer open, `toggle` focuses the trigger without a ring instead, because `pointerdown` prevented focus and arrow keys must still work.+2. **Preview on focus.** Focusing a trigger calls `showPopover({ source: trigger })` so the menu anchors to it. Ignore focus returning from inside the trigger's own menu, or from another window (flag on window `blur`, cleared a tick after window `focus`, or app-switching reopens the last menu). Hide a previewed menu on `blur` unless focus moved into it.+3. **Move focus in `toggle`, not `command`.** `command` fires before the menu opens.+4. **Restore focus to the trigger yourself.** Focus the trigger before `hidePopover()`. After a pointer activation, restore focus without a ring (`focus({ focusVisible: false })`), or the trigger shows the keyboard focus outline after a mouse click; keyboard activations keep the ring. A click with `event.detail === 0` came from the keyboard.+5. **Close one level at a time.** Call `stopPropagation()` on `Escape` and `ArrowLeft` in a submenu, or the parent's listener closes it too.++### Pointer handling++1. **Pointer click toggles.** Call `preventDefault()` on `pointerdown` so the click doesn't move focus and start a preview mid-click. Remember which trigger was pressed. Clicking a closed or previewed trigger opens or closes it natively and never enters the menu; only keyboard opens enter it. Do not intercept the click.+2. **Hover follows focus.** Style `:hover` and `:focus-visible` separately. On `pointermove` over an item, call `focus({ focusVisible: false })`; browsers that ignore the option paint no ring for pointer focus anyway.+3. **Hover switches open menus.** On `pointerenter` of a top-level trigger while another top-level menu is open: hide it, focus the hovered trigger without a ring, and preview on focus (see above) previews it. Nothing open: do nothing.+4. **Safe triangle.** A fixed CSS bridge is too narrow: it only works when the pointer starts near the parent's edge. Let CSS draw the bridge and use script only to report the pointer:+ * Run this only when `matchMedia('(hover: hover)').matches`; it is irrelevant to touch and keyboard.+ * Start when the pointer leaves a submenu trigger whose submenu is open. Skip a `--below` submenu, which has no side edge.+ * Set `--bridge-x` and `--bridge-y` (the pointer, in px relative to the submenu), `--bridge-edge` (the submenu's near-edge x: `0` when the pointer is to its left, its width when it flipped) and `--bridge-height` on the submenu, and `data-bridge` to switch the bridge on.+ * Stop after about 300 ms, when the pointer reaches an item in the submenu, or when the submenu closes. Remove the listener and the attribute. Nothing runs after that.+ * CSS gives the submenu a `::before` clipped to a triangle from the pointer to the near-edge corners. It sits over the sibling items on the pointer's path, so they never receive the hover that would close the submenu. `clip-path` also limits hit testing, so the rest of the parent menu stays interactive.+ * The submenu needs `overflow: visible` (a popover clips by default), and the pseudo-element extends past it, so offset the shape's points by that extent.+ * Follow-up: a curved path (`shape()` curve commands) follows real pointer arcs better than a straight triangle.++```css+[popover] [popover] {+ overflow: visible;++ &[data-bridge]::before {+ content: "";+ position: absolute;+ inset: -100vh -100vw; /* Room for the triangle, which can extend far outside the submenu. */+ clip-path: shape(+ from calc(100vw + var(--bridge-x)) calc(100vh + var(--bridge-y)),+ line to calc(100vw + var(--bridge-edge)) 100vh,+ line to calc(100vw + var(--bridge-edge)) calc(100vh + var(--bridge-height)),+ close+ );+ }+}+```++```js+const canHover = matchMedia('(hover: hover)');++// Call on pointerleave of a submenu trigger, with that trigger's submenu.+function startBridge(submenu, event) {+ if (!canHover.matches || !submenu.matches(':popover-open')) return;+ const rect = submenu.getBoundingClientRect();+ if (event.clientX >= rect.left && event.clientX <= rect.right) return; // --below: no side edge.+ const style = submenu.style;+ style.setProperty('--bridge-edge', `${event.clientX < rect.left ? 0 : rect.width}px`);+ style.setProperty('--bridge-height', `${rect.height}px`);+ const update = ({ clientX, clientY, target }) => {+ if (target !== submenu && submenu.contains(target)) return stop(); // Reached an item.+ style.setProperty('--bridge-x', `${clientX - rect.left}px`);+ style.setProperty('--bridge-y', `${clientY - rect.top}px`);+ };+ const timer = setTimeout(() => stop(), 300);+ const stop = () => {+ clearTimeout(timer);+ document.removeEventListener('pointermove', update);+ submenu.removeEventListener('toggle', stop);+ submenu.removeAttribute('data-bridge');+ };+ update(event);+ submenu.dataset.bridge = '';+ document.addEventListener('pointermove', update);+ submenu.addEventListener('toggle', stop, { once: true });+}+```++Hover follows focus (item 2) stays a plain `pointermove` handler: it needs no triangle logic.++Also:++* **Outside focus.** Close every open menu when focus lands outside the menu system (a `document` `focusin` listener).+* **Command activation.** Announce it, then hide the root menu and restore focus to its trigger, without a ring if the activation came from a pointer. For checkable items (`menuitemcheckbox`, `menuitemradio`), wait about 300 ms before closing so the changed check mark is visible. Style a closed trigger as active only on `:focus-visible`; otherwise the restored (ringless) focus leaves it highlighted after a pointer selection.+* **`aria-expanded`.** Set it only in the `toggle` listener. It covers preview and open states, and the trigger's `aria-expanded` stays `"true"` while its menu is previewed or open.+* **Helpers.** The fallbacks below assume helpers you define for your markup: `triggers` (all `[commandfor]` buttons), `menuFor(trigger)`, `isOpen(menu)`, `closeAndRestore(menu, { fromPointer })` (focus the trigger, without a ring when `fromPointer`, then `menu.hidePopover()`), `enterOnOpen` (a `WeakSet` of menus to enter once open) and `pointerTrigger` (the trigger last pressed by a pointer).++### Submenus++* Use `popover="auto"` for submenus, placed after the submenu trigger inside the parent's `focusgroup`. Never `popover="manual"`.+* Nesting lets the browser keep the parent open, close sibling submenus, close child submenus when the root menu closes, and handle outside-click light dismiss.+* The submenu trigger keeps `aria-haspopup="menu"` and `aria-expanded`; the `toggle` listener keeps `aria-expanded` in sync.+* The keyboard script handles nested `Escape` and `ArrowLeft` as described above.+* A submenu trigger never also runs a command: one control cannot both activate and open, and `Enter` cannot mean both. Put the default action as the first submenu item, or add a separate command item beside the trigger. If a combined control is forced, document it as an accessibility tradeoff.++### Separators and checkable items++* Separate item groups with `<hr>` inside the focusgroup: a native `separator`, not focusable, skipped by focusgroup and the fallback. Never a styled `<div>`.+* A boolean option is a `<button type="button">` with `aria-checked` and an explicit `role="menuitemcheckbox"`. Focusgroup does not infer these roles, so this is the one place shared markup sets an item role.+* One of a set is a `<button type="button">` with `role="menuitemradio"` and `aria-checked`, inside a `role="group"` with an `aria-label`, in the same focusgroup.+* Script toggles `aria-checked`.+* `Enter` on a checkbox toggles and closes the menu; `Space` toggles and stays open (APG). Radios close on either key.+* Render the check mark from `[aria-checked="true"]::before`, not a separate icon element (see the CSS below).++### Not covered here++* **Activation feedback.** Native menus flash the chosen item before closing. If wanted, show a ~100 ms visual confirm before `hidePopover()`; do not delay focus restoration or the announcement.+* **Typeahead.** Focusgroup has none. If needed, on printable `keydown` match the current level's enabled item labels and focus the next match after the current item, wrapping. Do not intercept `Space`.++## Verify before finishing++An instruction cannot guarantee behavior, so test the result. Open the page and check each of these with the real keyboard and mouse; fix and re-test any that fail:++* **Keyboard.** `Tab` lands on the first trigger once; `ArrowDown` enters; `Escape` closes one level and returns focus to its trigger; `Tab` closes every menu.+* **Pointer open.** Clicking a trigger opens its menu with focus on the trigger and no ring; clicking again closes it.+* **Pointer command.** Clicking a command closes every menu and shows no focus ring on the trigger.+* **Submenu.** Moving diagonally from the middle of a submenu trigger to a submenu item keeps it open; moving to an unrelated sibling closes it.+* **Narrow screen.** At 375 px no submenu covers its own trigger.+* **Check marks.** Checked items show a check mark.+* **No leftovers.** No console errors, and no `popovertarget`, `popovertargetaction` or `aria-details` on triggers.++## Align menu item content++When a row has an icon, label, and shortcut or submenu indicator, reserve a fixed-size leading slot for the icon or check mark and push the trailing content to the inline end. Icons are a known size, so a fixed slot keeps labels aligned whether or not an item has an icon. Do not use `subgrid` for rows: any extra inline child (a badge, for example) becomes its own grid item and breaks the layout. Hide shortcut text from assistive technology when it only repeats a key that already operates the item.++```css+[focusgroup~="menu"] {+ --menu-icon-size: 1.25rem;+}++/* Target items only. A closed submenu popover inside the focusgroup must keep display: none. */+[focusgroup~="menu"] > button,+[focusgroup~="menu"] > [role="group"] > button {+ display: flex;+ align-items: center;+ gap: .5rem;+}++/* The leading slot holds the icon or check mark. */+[focusgroup~="menu"] button::before {+ content: "";+ flex: none;+ inline-size: var(--menu-icon-size);+}++/* Check mark for checked items. This selector must be at least as specific as the base+ ::before rule above, or the empty content wins and the check mark never shows. */+[focusgroup~="menu"] button[aria-checked="true"]::before {+ content: "✓";+}++/* Shortcut or submenu indicator at the inline end. */+[focusgroup~="menu"] .hint {+ margin-inline-start: auto;+}+```++Put a trailing indicator or shortcut in a `<span class="hint" aria-hidden="true">` inside the button; the submenu trigger already announces its popup.++## Progressive enhancement and fallbacks++### Fallbacks & browser support for focusgroup++focusgroup is not natively supported by any major browser yet.++Keep `focusgroup="menu nomemory"` in the markup. If `'focusGroup' in HTMLElement.prototype` is false, install Up, Down, Home, and End, set `role="menu"` on each menu container, and `role="menuitem"` on buttons with no role; leave checkable items, `<hr>`, and `role="group"` alone. Never install it when native focusgroup is present. Left, Right, preview, open, and close are author script either way.++```js+if (!('focusGroup' in HTMLElement.prototype)) {+ document.querySelectorAll('[focusgroup~="menu"]').forEach(group => {+ group.setAttribute('role', 'menu');+ group.querySelectorAll('button:not([role])').forEach(item => {+ item.setAttribute('role', 'menuitem');+ });+ group.addEventListener('keydown', event => {+ if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;+ // Own items only: a nested submenu has its own focusgroup, a role="group" wrapper does not.+ const items = [...group.querySelectorAll('button')]+ .filter(item => item.closest('[focusgroup]') === group)+ .filter(item => !item.disabled && item.getAttribute('aria-disabled') !== 'true');+ const current = items.indexOf(document.activeElement);+ if (current < 0) return;+ const next = event.key === 'Home' ? 0 : event.key === 'End' ? items.length - 1 :+ (current + (event.key === 'ArrowUp' ? -1 : 1) + items.length) % items.length;+ event.preventDefault();+ event.stopImmediatePropagation();+ items[next].focus({ preventScroll: true });+ }, true);+ });+}+```++### Fallbacks & browser support for Popover++Baseline status for Popover: Newly available. It's been Baseline since 2025-01-27.+Supported by: Chrome 116 (Aug 2023), Edge 116 (Aug 2023), Firefox 125 (Apr 2024), Safari 17 (Sep 2023), and Safari iOS 18.3 (Jan 2025).++The Popover API is mostly **progressive enhancement**, but its defining behaviors — top-layer promotion, light-dismiss, and `popovertarget` invocation — have no CSS-only equivalent. Older browsers need a polyfill, or a manual fallback if you would rather not ship one.++**Polyfill:** To support the `popover` attribute in older browsers, conditionally load [`@oddbird/popover-polyfill`](https://github.com/oddbird/popover-polyfill). **MANDATORY:** Feature detect by checking for the `popover` property on `HTMLElement.prototype`, and load the polyfill **only** when native support is missing — do NOT load it unconditionally.++With a bundler or import map:++```js+// MANDATORY: Feature detect 'popover' on HTMLElement.prototype.+if (!("popover" in HTMLElement.prototype)) {+ import("@oddbird/popover-polyfill");+}+```++Without a bundler, import from a CDN inside a `<script type="module">`:++```html+<script type="module">+ if (!("popover" in HTMLElement.prototype)) {+ import("https://unpkg.com/@oddbird/popover-polyfill@latest/dist/popover.min.js");+ }+</script>+```++**Styling caveat:** The polyfill cannot define the real `:popover-open` pseudo-class, so it applies a `.\:popover-open` class instead. **MANDATORY:** Combine the two with `:is()` or `:where()`, otherwise browsers that lack `:popover-open` discard the entire rule:++```css+[popover]:is(:popover-open, .\:popover-open) {+ display: block;+}+```++Alternatively, for a legacy fallback without a polyfill, use `position: fixed` and manually calculate coordinates via `getBoundingClientRect()` or rely on default positioning with `inset: auto` if that's acceptable for the use case.++### Fallbacks & browser support for Anchor positioning++Browser support for Anchor positioning: Limited availability.+Supported by: Safari 27 (Sep 2026).+Unsupported in: Chrome, Edge, and Firefox.++Without CSS Anchor Positioning, a popover falls back to the UA's centered viewport placement. Never ship that for a menu: it detaches the menu from its trigger, and a centered submenu covers its parent. Gate the anchored rules behind `@supports (position-area: block-end)` and position the menu from script when it fails:++* Place the menu below its trigger (top level) or beside it (submenu), flipping to the other side and clamping to the viewport when it would overflow.+* Run it in the `toggle` handler when the menu opens, and apply the result as `left` and `top` on the menu. Use `position: fixed` with `inset: auto` and `margin: 0` so the coordinates are viewport-relative.+* Keep these overrides inside `@supports not (position-area: block-end)`, so browsers with anchor positioning are unaffected.++Baseline status for the api.HTMLElement.showPopover.options_source_parameter.implicit_anchor_reference capability: Newly available. It's been Baseline since 2026-01-13.+Supported by: Chrome 137 (May 2025), Edge 137 (May 2025), Firefox 147 (Jan 2026), and Safari 26 (Sep 2025).++If targeting earlier implementations where `showPopover({ source })` does not establish an implicit anchor (no `source` on `ToggleEvent.prototype`), give each trigger a unique `anchor-name` and each menu a matching `position-anchor` from script, instead of writing per-menu CSS rules.++For browsers without anchor positioning at all, see `viewport-aware-dropdowns` (via `npx -y modern-web-guidance@latest retrieve "viewport-aware-dropdowns"`) for the polyfill route.++### Fallbacks & browser support for Invoker commands++Baseline status for Invoker commands: Newly available. It's been Baseline since 2025-12-12.+Supported by: Chrome 135 (Apr 2025), Edge 135 (Apr 2025), Firefox 144 (Oct 2025), and Safari 26.2 (Dec 2025).++Without invokers, `command="toggle-popover"` does nothing, so script must toggle the menu.++* Feature-detect the interface, not an instance: `'commandForElement' in HTMLButtonElement.prototype`.+* On each trigger `click`, call `preventDefault()` so a browser with invokers cannot toggle twice.+* If the menu is open, close it with `closeAndRestore(menu)`. Otherwise call `menu.showPopover({ source: trigger })`.+* Mark the menu in `enterOnOpen` unless the click came from the pressed trigger (`pointerTrigger`), so only keyboard opens enter the menu.+* `Enter` and `Space` still work because they generate a click on buttons.diff --git a/skills/modern-web-guidance/guides/ui-components/persistent-app-tours.md b/skills/modern-web-guidance/guides/ui-components/persistent-app-tours.mdindex 9ae64e3..7416523 100644--- a/skills/modern-web-guidance/guides/ui-components/persistent-app-tours.md+++ b/skills/modern-web-guidance/guides/ui-components/persistent-app-tours.md@@ -95,7 +95,7 @@ Alternatively, for a legacy fallback without a polyfill, use `position: fixed` a#### anchor-positioningBrowser support for Anchor positioning: Limited availability.-Supported by: Safari 27.+Supported by: Safari 27 (Sep 2026).Unsupported in: Chrome, Edge, and Firefox.To support browsers without anchor positioning, you can choose between using a polyfill or a pure CSS fallback.diff --git a/skills/modern-web-guidance/guides/ui-components/progress.md b/skills/modern-web-guidance/guides/ui-components/progress.mdindex cea9a38..b71747b 100644--- a/skills/modern-web-guidance/guides/ui-components/progress.md+++ b/skills/modern-web-guidance/guides/ui-components/progress.md@@ -176,6 +176,6 @@ If `accent-color` is not supported and styling the progress bar is required, use### Fallbacks & browser support for `revert-rule`Baseline status for revert-rule: Newly available. It's been Baseline since 2026-09-14.-Supported by: Chrome 148 (May 2026), Edge 148 (May 2026), Firefox 150 (Apr 2026), and Safari 27.+Supported by: Chrome 148 (May 2026), Edge 148 (May 2026), Firefox 150 (Apr 2026), and Safari 27 (Sep 2026).If `revert-rule` is not supported, `animation: var(--progress-bar-animation, revert-rule)` falls back to `animation-name: revert-rule` with a `0s` duration when `--progress-bar-animation` is unset, which is a harmless no-op when no `@keyframes revert-rule` exists.diff --git a/skills/modern-web-guidance/guides/visual-design/custom-text-decorations.md b/skills/modern-web-guidance/guides/visual-design/custom-text-decorations.mdnew file mode 100644index 0000000..f255eb7--- /dev/null+++ b/skills/modern-web-guidance/guides/visual-design/custom-text-decorations.md@@ -0,0 +1,337 @@+# Custom text decorations++Use the native `text-decoration` properties to style underlines, overlines, and strikethroughs, instead of faking them with borders, background gradients, or pseudo-elements. A native decoration follows the text across wrapped lines, tracks the font's metrics, skips glyph descenders, and inherits through nested elements, so none of that needs to be reimplemented. Reach for the box-based techniques at the end of this guide only when the decoration must outline or wrap the text rather than run along it.++Text decorations apply to any text, not only links. Where underlined text is not a link, make sure it cannot be mistaken for one. When decorating a link, use a real `<a href>` pointing at the destination (add `target="_blank" rel="noopener"` to open a new tab), not `href="javascript:void(0)"` with a script handler. A real link keeps middle-click, copy-link, and screen reader behavior.++## Style the line++Set line, style, color, and thickness with the `text-decoration` shorthand, and the gap from the text with `text-underline-offset`. Wrap the selector in `:where()` so the defaults have zero specificity and any later override wins, without needing custom properties.++```css+:where(.decorated) {+ /* Thickness is relative to the font size (0.08em is an example value), so the line is not too heavy+ on small text or too light on large text, and max() keeps it at least 1px so it never disappears. */+ text-decoration: underline solid currentColor max(1px, 0.08em);+ /* Use em so the gap scales with the font size. 0.2em clears most descenders; example value. */+ text-underline-offset: 0.2em;+}++/* Example hover state: a softer line that firms up on hover and focus. The 50% mix and+ 0.12em thickness are example values. */+:where(.decorated) {+ text-decoration-color: color-mix(in srgb, currentColor, transparent);+}++:where(.decorated:is(:hover, :focus-visible)) {+ text-decoration-color: currentColor;+ text-decoration-thickness: max(1px, 0.12em);+}++/* Other lines are a different text-decoration-line on the same properties */+.decorated-over { text-decoration-line: overline; }+.decorated-through { text-decoration-line: line-through; }+```++`text-decoration-style` accepts `solid`, `double`, `dotted`, `dashed`, and `wavy`. `text-underline-offset` applies to underlines only.++Starting points for the design:++* **Thickness:** about `0.06em` to `0.1em` for body text. Go thicker (`0.1em` to `0.15em`) for headings and emphasized states.+* **Offset:** about `0.15em` to `0.25em`. Dotted and wavy lines need a little more room than solid ones, so raise the offset for them.+* **Color:** `currentColor` keeps the line matched to the text. A softer mix of the text color that firms up on hover keeps long runs of links calm.+* **Style:** `solid` for links, `dotted` for terms and abbreviations, and `wavy` for annotations such as errors.++## Control where the line is skipped++### Ink skipping++By default, underlines and overlines break around glyph parts that cross them, such as descenders. Set `text-decoration-skip-ink` to choose the behavior:++```css+.decorated {+ /* auto: skip ink for most scripts (default). none: draw straight through.+ all: also skip ink in scripts where auto does not, such as Japanese or Chinese. */+ text-decoration-skip-ink: all;+}+```++* Keep `auto` for Latin text, and do not declare it: it is the default.+* Use `all` when the underline sits close enough to the baseline to cross ideographic glyphs, or when mixed-script text must look consistent.+* Use `none` for a very thick line, or a deliberately decorative one, where gaps would look like breaks.+++#### Skip spaces++`text-decoration-skip-spaces` decides whether the line is drawn under spaces. The default, `start end`, leaves leading and trailing spaces undecorated.++```css+.decorated {+ /* Spaces collapse by default, so there is nothing to skip. Preserve them when the+ leading or trailing spaces are meaningful, such as padded input values. */+ white-space: pre;+ /* none: decorate every space. all: skip every space, so each word is underlined separately.+ start | end | start end: skip only leading, trailing, or both. */+ text-decoration-skip-spaces: all;+}+```++Do not declare `text-decoration-skip-spaces` unless the decoration should visibly cover padding (`none`) or break between every word (`all`). Ordinary inline text, such as the text of a link, has no leading or trailing spaces, so the declaration does nothing.++## Trim or extend the line with an inset++`text-decoration-inset` moves the start and end of the line. A positive value pulls an end inward, a negative value pushes it outward. One value moves both ends; two values set start and end separately. Percentages refer to the inline size of the decorated box.++```css+/* Small insets soften the ends of the line; larger ones read as a deliberately short line.+ Both values are examples. */+.trimmed { text-decoration-inset: var(--deco-inset, 0.1em); }+.extended { text-decoration-inset: calc(var(--deco-inset, 0.1em) * -1); }+```++To reveal an underline on hover without a border or background gradient, trim the end by 100% and transition it back to 0:++```css+.reveal {+ text-decoration: underline; /* Always visible, including for reduced motion */+}++/* Only hide and animate the line when the user has not asked for reduced motion. */+@media (prefers-reduced-motion: no-preference) {+ .reveal {+ /* Trim the end by the full inline size so the line starts with zero length. */+ text-decoration-inset: 0 100%;+ /* 150ms to 300ms feels responsive without lagging; ease-out starts quickly. Example values. */+ transition: text-decoration-inset var(--reveal-duration, 0.25s) ease-out;+ }++ /* Include :focus-visible so keyboard users get the same reveal as pointer users. */+ .reveal:is(:hover, :focus-visible) {+ text-decoration-inset: 0 0;+ }+}+```++## Draw a custom line with a pseudo-element++Use a pseudo-element when the line must be a shape `text-decoration` cannot draw, such as a squiggle, and reveal it by clipping. No extra markup is needed, so the link stays a plain `<a>`.++```html+<a class="draw" href="#">Hover to draw underline</a>+```++```css+.draw {+ position: relative;+ display: inline-block;+ color: inherit;+ text-decoration: none;+ padding-block-end: 0.4em; /* Space for the line below the text; example value */+}++.draw::after {+ content: "";+ position: absolute;+ inset: auto 0 0 0;+ block-size: 0.4em; /* Height of the squiggle; example value */+ pointer-events: none;+ border: var(--deco-thickness, max(1px, 0.08em)) solid var(--deco-color, currentColor);+ /* A single shape strokes along its path, using the border width as the stroke. Example squiggle. */+ border-shape: shape(from 0% 50%,+ curve to 20% 50% with 5% 0% / 15% 100%,+ smooth to 40% 50% with 35% 100%,+ smooth to 60% 50% with 55% 100%,+ smooth to 80% 50% with 75% 100%,+ smooth to 100% 50% with 95% 100%);+}++/* Only hide and animate the line when the user has not asked for reduced motion;+ otherwise it stays fully drawn. */+@media (prefers-reduced-motion: no-preference) {+ .draw::after {+ /* Clip the line away from the right edge. The negative block insets keep the stroke+ from being cut off vertically. */+ clip-path: inset(-1em 100% -1em 0);+ /* A slightly slower draw than a hover reveal reads as drawing; example duration. */+ transition: clip-path var(--draw-duration, 0.6s) ease-out;+ }++ .draw:is(:hover, :focus-visible)::after {+ clip-path: inset(-1em 0 -1em 0); /* Fully drawn */+ }+}+```++For a freeform path or a draw-on that follows the stroke, see `line-drawing-animation` (via `npx -y modern-web-guidance@latest retrieve "line-drawing-animation"`).++## Outline text with a box instead++Two box properties decorate text by outlining it rather than running a line along it. Give the text padding so the outline does not touch it.++```css+/* Gradient outline with a see-through middle */+.ring {+ padding: 0.2em 0.75em; /* Example values: enough room that the outline does not touch the text */+ /* The border width is the visible outline thickness. Relative to the font size, with a 2px+ minimum so it stays visible on small text; example value. */+ border: var(--ring-width, max(2px, 0.12em)) solid transparent;+ background: linear-gradient(135deg, var(--ring-start, #2563eb), var(--ring-end, #db2777)) border-box;+ /* Paint the background only under the border, so the inside stays transparent. */+ background-clip: border-area;+}++/* Border that follows a shape that border-radius cannot draw, such as a tag with a pointed end */+.tag {+ padding: 0.2em 1.5em 0.2em 0.9em; /* Example values: extra room at the point so the text is not clipped */+ border: var(--shape-stroke, max(2px, 0.08em)) solid var(--shape-color, currentColor); /* Example stroke width */+ /* A single shape strokes along its path. Two shapes fill the area between them.+ This polygon is an example; use shape() for curves. */+ border-shape: polygon(0 0, 85% 0, 100% 50%, 85% 100%, 0 100%);+}+```++`border-shape` replaces only the border. The background is still the rectangular box, so do not rely on it to fill a shape.++When only the corners need a different shape, such as a beveled, scooped, or notched label, use `corner-shape` with `border-radius` instead. It keeps the background and border following the corners, and unsupported browsers fall back to ordinary rounded corners.++```css+.label {+ padding: 0.2em 0.9em; /* Example values */+ border: var(--shape-stroke, max(2px, 0.08em)) solid var(--shape-color, currentColor);+ border-radius: 0.6em; /* Corner size; example value */+ corner-shape: bevel; /* round (default) | scoop | bevel | notch | square | squircle */+}+```++## Choose a technique++* **`text-decoration`** (line, ink skipping, spaces, inset): the line should run along the text, wrap with it, and follow its font metrics. This is the default choice.+* **Pseudo-element with `border-shape` and `clip-path`**: the line is a custom shape or needs a draw-on animation. Choose it only when `text-decoration-style` cannot produce the look, because it needs extra positioning. For vector path animations, see `line-drawing-animation` (via `npx -y modern-web-guidance@latest retrieve "line-drawing-animation"`).+* **`background-clip: border-area`**: the text needs a gradient outline. Use plain `border-color` when a solid outline is enough. For complete gradient border styling, see `gradient-borders` (via `npx -y modern-web-guidance@latest retrieve "gradient-borders"`).+* **`corner-shape`**: only the corners need a different shape, such as beveled, scooped, or notched. Pair it with `border-radius`, which sets the corner size.+* **`border-shape`**: the outline needs a shape `border-radius` cannot draw, such as a tag or arrow. Use `border-radius` when rounded corners are enough. For shaped element styling, see `element-shape` (via `npx -y modern-web-guidance@latest retrieve "element-shape"`).+* **Inset hover reveal**: worth adding when a link needs a hover affordance beyond a color change. Skip it for text that is not interactive.++## Fallback Strategies++Each fallback keeps the text readable and keeps the core decoration. Frame the need in terms of your Baseline target: if it includes browsers without a property, apply the matching fallback.++### Ink skipping `all`++Baseline status for text-decoration-skip-ink: all: Newly available. It's been Baseline since 2026-05-07.+Supported by: Chrome 148 (May 2026), Edge 148 (May 2026), Firefox 75 (Apr 2020), and Safari 15.4 (Mar 2022).++If your Baseline target does not support `text-decoration-skip-ink: all`, the declaration is ignored and the browser keeps `auto`. Latin descenders are still skipped; only scripts that `auto` does not cover, such as Japanese, lose ink skipping. This is graceful degradation, so no extra code is needed.++### Skip spaces++If your Baseline target does not support `text-decoration-skip-spaces`, the browser uses its own default handling of spaces. This is graceful degradation: the line is drawn under spaces the browser does not skip.++### Inset++If your Baseline target does not support `text-decoration-inset`, the+declaration is ignored, so the link keeps its normal, fully visible underline+and the transition has nothing to animate. This is graceful degradation: the+hover reveal is lost and the link stays underlined.++### Border area++Browser support for background-clip: border-area: Limited availability.+Supported by: Chrome 150 (Jun 2026), Edge 150 (Jul 2026), and Safari 18.2 (Dec 2024).+Unsupported in: Firefox.++If your Baseline target does not support `background-clip: border-area`, the declaration is ignored and the background paints under the whole border box, filling the text instead of only its outline. Do NOT settle for a plain solid border when the gradient is part of the design. Reproduce the gradient instead, and apply `background-clip: border-area` only inside `@supports`.++Use an opaque layer when the element's background is a known flat color. Paint the surface color over the padding box and the gradient under the border box, so the gradient shows only through the transparent border:++```css+.ring {+ border: var(--ring-width, max(2px, 0.12em)) solid transparent; /* Example width */+ /* Fallback: an opaque surface layer hides the gradient inside the border. */+ background:+ linear-gradient(var(--surface, canvas) 0 100%) padding-box,+ linear-gradient(135deg, var(--ring-start, #2563eb), var(--ring-end, #db2777)) border-box;+}++@supports (background-clip: border-area) {+ .ring {+ background: linear-gradient(135deg, var(--ring-start, #2563eb), var(--ring-end, #db2777)) border-box;+ background-clip: border-area; /* The inside stays transparent */+ }+}+```++Use a masked pseudo-element when the inside must stay transparent. The pseudo-element carries the gradient, and a mask cuts out everything but its padding ring:++```css+@supports not (background-clip: border-area) {+ .ring {+ position: relative;+ border-color: transparent;+ }++ .ring::before {+ content: "";+ position: absolute;+ inset: calc(var(--ring-width, max(2px, 0.12em)) * -1); /* Cover the border box */+ padding: var(--ring-width, max(2px, 0.12em)); /* Ring thickness */+ border-radius: inherit;+ background: linear-gradient(135deg, var(--ring-start, #2563eb), var(--ring-end, #db2777));+ /* Keep only the area between the content box and the border box. */+ mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);+ mask-composite: exclude;+ pointer-events: none;+ }+}+```++### Border shape++Browser support for border-shape: Limited availability.+Supported by: Chrome 147 (Apr 2026) and Edge 147 (Apr 2026).+Unsupported in: Firefox and Safari.++If your Baseline target does not support `border-shape`, the declaration is ignored and the element keeps its rectangular border. A rounded rectangle is only an acceptable fallback when the shape is purely decorative. When the shape carries meaning, such as a tag, arrow, or callout, reproduce it as closely as possible, and apply `border-shape` only inside `@supports`.++Draw the outline with a clipped pseudo-element. Keep a transparent border so the box is the same size as in the supported case, fill the pseudo-element with the outline color, and cut it into a ring with an `evenodd` `clip-path`: the outer shape, then the same shape inset by the stroke width.++```css+.tag {+ --stroke: max(2px, 0.08em); /* Example stroke width */+ position: relative;+ padding: 0.2em 1.5em 0.2em 0.9em; /* Example values */+ border: var(--stroke) solid transparent;+}++@supports not (border-shape: circle(50%)) {+ .tag::before {+ content: "";+ position: absolute;+ inset: calc(var(--stroke) * -1); /* Cover the border box */+ background: var(--shape-color, currentColor);+ pointer-events: none;+ /* Outer shape, then the inner shape inset by the stroke. The inner points are approximate on+ diagonal edges, so the stroke looks slightly thinner there. */+ clip-path: polygon(evenodd,+ 0 0, 85% 0, 100% 50%, 85% 100%, 0 100%,+ var(--stroke) var(--stroke),+ calc(85% - var(--stroke)) var(--stroke),+ calc(100% - var(--stroke) * 2) 50%,+ calc(85% - var(--stroke)) calc(100% - var(--stroke)),+ var(--stroke) calc(100% - var(--stroke)));+ }+}++@supports (border-shape: circle(50%)) {+ .tag {+ border-color: var(--shape-color, currentColor);+ border-shape: polygon(0 0, 85% 0, 100% 50%, 85% 100%, 0 100%);+ }+}+```++For a filled shape rather than an outline, put `clip-path: polygon(...)` with the same points directly on the element.++For the pseudo-element underline, draw a straight line with `border-block-end` on `.draw::after`, and apply the `block-size`, `border`, and `border-shape` squiggle only inside `@supports (border-shape: circle(50%))`. The line is straight but still draws on, because the `clip-path` animation does not depend on the shape.++`clip-path` also clips focus rings and `box-shadow`. Do not rely on an outline on the clipped element to show focus; style `:focus-visible` with a color or background change instead.diff --git a/skills/modern-web-guidance/guides/visual-design/dark-mode.md b/skills/modern-web-guidance/guides/visual-design/dark-mode.mdindex aeda645..dc40bac 100644--- a/skills/modern-web-guidance/guides/visual-design/dark-mode.md+++ b/skills/modern-web-guidance/guides/visual-design/dark-mode.md@@ -231,7 +231,7 @@ pre, code {### Fallbacks & browser support for light-dark() image valuesBaseline status for light-dark() image values: Newly available. It's been Baseline since 2026-09-14.-Supported by: Chrome 150 (Jun 2026), Edge 150 (Jul 2026), Firefox 150 (Apr 2026), and Safari 27.+Supported by: Chrome 150 (Jun 2026), Edge 150 (Jul 2026), Firefox 150 (Apr 2026), and Safari 27 (Sep 2026).For browsers that do not support `light-dark()` for images, use `image-set()` as a switch:give each option a `type()` from a custom property, and set the inactive one to an unsupported MIME type so the browser discards that option.diff --git a/skills/modern-web-guidance/guides/webmcp/agentic-forms.md b/skills/modern-web-guidance/guides/webmcp/agentic-forms.mdindex a49b7ae..c47d285 100644--- a/skills/modern-web-guidance/guides/webmcp/agentic-forms.md+++ b/skills/modern-web-guidance/guides/webmcp/agentic-forms.md@@ -2,6 +2,8 @@The Declarative API transforms standard HTML `<form>` elements into WebMCP tools via attributes. The browser synthesizes a JSON Schema from the form inputs and handles agent interactions.+**Angular Signal Forms:** **DO NOT** add `toolname`/`tooldescription` to forms built with `form()` from `@angular/forms/signals`. Instead, add `provideExperimentalWebMcpForms()` to the app providers and pass the `experimentalWebMcpTool: { name, description }` option to `form()`. Angular then registers the form through the Imperative API, building the schema from the signal model and wiring it to validation and submission. Using both approaches registers the same form twice.+## Form Attributes* `toolname`: Unique name for the tool.diff --git a/skills/modern-web-guidance/guides/webmcp/agentic-javascript-tools.md b/skills/modern-web-guidance/guides/webmcp/agentic-javascript-tools.mdindex 905029d..fefe3eb 100644--- a/skills/modern-web-guidance/guides/webmcp/agentic-javascript-tools.md+++ b/skills/modern-web-guidance/guides/webmcp/agentic-javascript-tools.md@@ -376,6 +376,24 @@ In TypeScript projects, **DO NOT** hand-write declarations for `document.modelCo* With an inline `inputSchema`, the `execute` input type is inferred from the schema.* Named types such as `WebMCP.ModelContextTool` are global (no import needed), useful for typing tool factories.+## Framework support++**MANDATORY:** If the app uses React, Angular, or Vue, register tools through that framework's official WebMCP integration, listed below. **DO NOT** call `document.modelContext.registerTool()` from components or write your own lifecycle wrapper. Each integration already handles feature detection, `AbortSignal` cleanup, and scoping tools to the component or injector lifecycle. These APIs are experimental, so before writing code, look up the current signature in the package's types or docs.++| Framework | Package | API | Docs |+|---|---|---|---|+| React 18+ | `use-webmcp-tool` | `useWebMCP(options)`: one call per tool | npmjs.com/package/use-webmcp-tool |+| Angular | `@angular/core`, `@angular/forms/signals` | `provideExperimentalWebMcpTools([...])` (app or route providers), `declareExperimentalWebMcpTool(...)` (inside services), `provideExperimentalWebMcpForms()` + the `experimentalWebMcpTool` option on Signal Forms | angular.dev/ai/webmcp |+| Vue | `@vueuse/core` | `useWebMCP(options)` composable | vueuse.org/core/usewebmcp |++All the rules in this guide still apply when you use these integrations:+* Keep the tool definition shape the same: `name`, `description`, `inputSchema`, `execute(input, { signal })`, and `annotations`.+* Follow the rules for descriptions and annotations.+* Validate input and apply defaults inside `execute`.+* Pass `signal` to long-running work.+* To offer a tool only some of the time, pass `enabled` (React, Vue). **DO NOT** wrap the hook or composable call in a condition.+* Integrations may wrap results and errors (for example as `{ content, isError }`). Check the integration's docs before relying on how errors reach the agent.+## API Notes* **annotations**: (Optional) A dictionary for tool metadata.diff --git a/skills/modern-web-guidance/guides/webmcp/webmcp.md b/skills/modern-web-guidance/guides/webmcp/webmcp.mdindex c714de1..93f3678 100644--- a/skills/modern-web-guidance/guides/webmcp/webmcp.md+++ b/skills/modern-web-guidance/guides/webmcp/webmcp.md@@ -12,6 +12,7 @@ Currently, WebMCP **only supports Tools**. It does not support the "Resources" o- **Imperative API**: Use `document.modelContext.registerTool()` for complex logic and dynamic interactions.- **Declarative API**: Annotate standard HTML `<form>` elements with `toolname` and `tooldescription` to turn them into tools.+- **Frameworks (MANDATORY)**: React uses `useWebMCP` from `use-webmcp-tool`. Angular uses `provideExperimentalWebMcpTools` / `declareExperimentalWebMcpTool` from `@angular/core`. Vue uses `useWebMCP` from `@vueuse/core`. **DO NOT** call `registerTool()` from components.## Best Practices