Skip to content

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

Release v0.0.60

github-actions[bot]7e396431ce56
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 11b379e..458fd7a 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -8,7 +8,7 @@
"name": "modern-web-guidance",
"source": "./",
"description": "Google Chrome's agent skills collection",
- "version": "0.0.59"
+ "version": "0.0.60"
}
]
}
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 0ca1211..b43d754 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Google Chrome's agent skills collection",
- "version": "0.0.59",
+ "version": "0.0.60",
"author": {
"name": "Google Chrome"
}
diff --git a/README.md b/README.md
index fdd8953..04e1342 100644
--- a/README.md
+++ b/README.md
@@ -2,10 +2,10 @@
This curated collection of skills, tools, and AI-ready documentation injects Chrome's web platform knowledge directly into your workflow, ensuring your coding agent builds apps that are modern, fast, and secure by default.
-#### Skill Coverage in `v0.0.59`
+#### Skill Coverage in `v0.0.60`
<details>
-<summary><strong>72 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `&lt;details>`, `&lt;dialog closedby>`, `&lt;dialog>`, `&lt;link rel="expect">`, `&lt;link rel="preload">`, `AbortController and AbortSignal`, `Active view transition`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `content-visibility`, `Cross-document view transitions`, `Customizable &lt;select>`, `Email, telephone, and URL &lt;input> types`, `enterkeyhint`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intl.DurationFormat`, `Invoker commands`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive &lt;details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `View transitions`, `view-transition-class`</summary>
+<summary><strong>73 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `&lt;details>`, `&lt;dialog closedby>`, `&lt;dialog>`, `&lt;link rel="expect">`, `&lt;link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `content-visibility`, `Cross-document view transitions`, `Customizable &lt;select>`, `Email, telephone, and URL &lt;input> types`, `enterkeyhint`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intl.DurationFormat`, `Invoker commands`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive &lt;details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `View transitions`, `view-transition-class`</summary>
- **[::backdrop](https://webstatus.dev/features/backdrop), [&lt;dialog>](https://webstatus.dev/features/dialog), [overlay](https://webstatus.dev/features/overlay), [Popover](https://webstatus.dev/features/popover), [@starting-style](https://webstatus.dev/features/starting-style), [transition-behavior](https://webstatus.dev/features/transition-behavior)**
- **animate-to-from-top-layer**: Animate elements such as dialogs, popovers, and tooltips as they're entering/exiting the top layer.
@@ -33,6 +33,8 @@ This curated collection of skills, tools, and AI-ready documentation injects Chr
- **[AbortController and AbortSignal](https://webstatus.dev/features/aborting), [fetchLater](https://webstatus.dev/features/fetchlater)**
- **batch-analytics-events**: Debounce and batch multiple analytics events together in a single beacon to minimize network contention and reduce server load, while still delivering real-time updates.
- **full-session-analytics**: Reliably track analytics, errors, and telemetry data across the user's entire page visit, and defer sending of the data until the user leaves the page.
+- **[accent-color](https://webstatus.dev/features/accent-color)**
+ - **brand-consistent-forms**: Match checkboxes, radio buttons, range sliders, and progress bars to your site's color palette without replacing them with custom components.
- **[Active view transition](https://webstatus.dev/features/active-view-transition), [View transitions](https://webstatus.dev/features/view-transitions)**
- **directional-navigation-transitions**: Animate visual state changes to reflect the direction of a user's navigational flow, such as sliding new content in from the right when advancing forward or from the left when returning to a previous screen.
- **[Anchor positioning](https://webstatus.dev/features/anchor-positioning), [prefers-reduced-motion media query](https://webstatus.dev/features/prefers-reduced-motion)**
diff --git a/gemini-extension.json b/gemini-extension.json
index 57d940d..28b57ae 100644
--- a/gemini-extension.json
+++ b/gemini-extension.json
@@ -1,7 +1,7 @@
{
"name": "modern-web-guidance",
"description": "Google Chrome's web development agent skills.",
- "version": "0.0.59",
+ "version": "0.0.60",
"author": {
"name": "Google Chrome"
}
diff --git a/package.json b/package.json
index 2514e0d..8119151 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "modern-web-guidance",
"displayName": "Modern Web Guidance",
"description": "Curated collection of agent skills for modern web development.",
- "version": "0.0.59",
+ "version": "0.0.60",
"publisher": "GoogleChrome",
"engines": {
"vscode": "^1.90.0",
diff --git a/skills/modern-web/guides/forms/brand-consistent-forms.md b/skills/modern-web/guides/forms/brand-consistent-forms.md
new file mode 100644
index 0000000..23bca1b
--- /dev/null
+++ b/skills/modern-web/guides/forms/brand-consistent-forms.md
@@ -0,0 +1,243 @@
+# Brand-Consistent Forms
+
+Customizing standard HTML form elements like checkboxes and radio buttons has historically been difficult. Developers often faced a choice between using the browser defaults or building custom components from scratch. Building custom controls is time-consuming and can easily lead to accessibility issues or missing states (like the indeterminate state for checkboxes).
+
+The CSS property `accent-color` provides a simple way to bring your brand color to built-in HTML form inputs with a single line of CSS, without sacrificing accessibility or built-in browser features.
+
+## How to Implement
+
+To apply your brand color to form controls:
+
+1. **Identify your brand color:** Choose a color that represents your brand.
+2. **Apply the `accent-color` property:** Add `accent-color` to the element or a container element (like `body` or a specific form) in your CSS.
+3. **Support Dark Mode (Optional but Recommended):** Use `color-scheme` to let the browser know your site supports dark mode, and adjust the `accent-color` if necessary for better contrast.
+
+## Example Code: Brand-Consistent Form Controls
+
+```css
+:root {
+ --brand-color: #6200ee;
+}
+
+/* Apply accent-color to the body or a specific container */
+body {
+ accent-color: var(--brand-color);
+}
+
+/* Optional: Adjust for dark mode if needed */
+@media (prefers-color-scheme: dark) {
+ :root {
+ --brand-color: #bb86fc; /* A lighter shade for dark mode */
+ }
+}
+```
+
+```html
+<form>
+ <!-- Checkbox -->
+ <label>
+ <input type="checkbox" checked>
+ Subscribe to newsletter
+ </label>
+
+ <!-- Radio Buttons -->
+ <label>
+ <input type="radio" name="plan" value="monthly">
+ Monthly
+ </label>
+ <label>
+ <input type="radio" name="plan" value="yearly" checked>
+ Yearly
+ </label>
+
+ <!-- Range Slider -->
+ <label for="volume">Volume:</label>
+ <input type="range" id="volume" min="0" max="100" value="70">
+
+ <!-- Progress Bar -->
+ <label for="file">Upload Progress:</label>
+ <progress id="file" max="100" value="70">70%</progress>
+</form>
+```
+
+## Strategic Implementation & Best Practices
+
+- **DO** use `accent-color` to easily theme form controls to match your brand.
+- **DO NOT** blindly trust the browser to handle contrast. While browsers are supposed to automatically determine an eligible contrast color, known bugs in implementations like **Safari** (WebKit bug 244233) and **Android Chrome** (Chromium bug 343503163) can fail to invert checkmark colors, leading to invisible or hard-to-see controls when using colors that lack sufficient contrast against the background (e.g., light colors in light mode, or dark colors in dark mode).
+- **DO** combine `accent-color` with `color-scheme: light dark` to ensure form controls look good in both light and dark themes.
+- **DO NOT** use a color that is too close to the background color, even though browsers try to guarantee contrast, it's best to provide a color with good base contrast.
+- **DO NOT** assume `accent-color` works on all form elements. Currently, it only tints `checkbox`, `radio`, `range`, and `progress` elements.
+
+## Fallback Strategy
+
+accent-color has limited availability.
+
+For browsers that do not support `accent-color`, the form controls fall back to the browser's default appearance. To ensure full brand consistency and high reliability across all environments, you MUST implement a custom fallback strategy using the established "visually hidden input" technique.
+
+### Progressive Enhancement with `@supports not`
+
+You MUST use the `@supports not` rule to apply custom fallback styles only when `accent-color` is not supported. This ensures you leverage the simplicity of `accent-color` for modern browsers while guaranteeing a consistent branded experience for older ones.
+
+#### 1. HTML Structure
+Ensure your labels wrap the text in a `<span>` to allow for sibling selectors in CSS:
+```html
+<label>
+ <input type="checkbox" checked>
+ <span>Subscribe to newsletter</span>
+</label>
+```
+
+#### 2. CSS Fallback
+Apply custom styles within a `@supports not` block:
+```css
+/* Fallback for older browsers without accent-color */
+@supports not (accent-color: var(--brand-color)) {
+ /* Visually hide the native input */
+ form input[type="checkbox"] {
+ position: absolute;
+ opacity: 0;
+ width: 0;
+ height: 0;
+ }
+
+ /* Style the wrapper label */
+ label {
+ position: relative;
+ padding-left: 2rem;
+ cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ }
+
+ /* Custom box for checkbox */
+ input[type="checkbox"] + span::before {
+ content: "";
+ position: absolute;
+ left: 0;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 1.2rem;
+ height: 1.2rem;
+ border: 2px solid #ccc;
+ background: white;
+ border-radius: 4px;
+ box-sizing: border-box;
+ transition: all 0.2s ease;
+ }
+
+ /* Checked State */
+ input[type="checkbox"]:checked + span::before {
+ background-color: var(--brand-color, #6200ee);
+ border-color: var(--brand-color, #6200ee);
+ }
+
+ /* Checkmark (Unicode) */
+ input[type="checkbox"]:checked + span::after {
+ content: "✓";
+ position: absolute;
+ left: 0.25rem;
+ top: 50%;
+ transform: translateY(-50%);
+ color: white;
+ font-weight: bold;
+ font-size: 0.9rem;
+ }
+
+ /* Fallback for Range Slider */
+ input[type="range"] {
+ -webkit-appearance: none;
+ appearance: none;
+ background: transparent;
+ }
+
+ /* Webkit (Chrome, Safari, Edge) */
+ input[type="range"]::-webkit-slider-runnable-track {
+ width: 100%;
+ height: 8px;
+ /* Use gradient to show progress for a static value (e.g., 70%) or update with JS */
+ background: linear-gradient(to right, var(--brand-color, #6200ee) 70%, #ccc 70%);
+ border-radius: 4px;
+ }
+
+ input[type="range"]::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ height: 16px;
+ width: 16px;
+ border-radius: 50%;
+ background: var(--brand-color, #6200ee);
+ cursor: pointer;
+ margin-top: -4px; /* Center vertically */
+ }
+
+ /* Firefox */
+ input[type="range"]::-moz-range-track {
+ width: 100%;
+ height: 8px;
+ background: #ccc;
+ border-radius: 4px;
+ }
+
+ input[type="range"]::-moz-range-thumb {
+ height: 16px;
+ width: 16px;
+ border-radius: 50%;
+ background: var(--brand-color, #6200ee);
+ cursor: pointer;
+ }
+
+ /* Firefox specific progress bar */
+ input[type="range"]::-moz-range-progress {
+ background-color: var(--brand-color, #6200ee);
+ height: 8px;
+ border-radius: 4px;
+ }
+
+ /* Fallback for Progress Bar */
+ progress {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ border: none;
+ background: #ccc;
+ height: 8px;
+ border-radius: 4px;
+ }
+
+ progress::-webkit-progress-bar {
+ background-color: #ccc;
+ border-radius: 4px;
+ }
+
+ progress::-webkit-progress-value {
+ background-color: var(--brand-color, #6200ee);
+ border-radius: 4px;
+ }
+
+ progress::-moz-progress-bar {
+ background-color: var(--brand-color, #6200ee);
+ border-radius: 4px;
+ }
+}
+```
+
+### Dynamic Range Progress in Webkit Fallback
+
+To make the progress fill move with the thumb on a range slider in Webkit browsers (without `accent-color`), you can use a CSS variable and a small amount of JavaScript.
+
+1. **Update CSS**: Use a CSS variable for the gradient stop:
+```css
+input[type="range"]::-webkit-slider-runnable-track {
+ background: linear-gradient(to right, var(--brand-color) var(--progress, 0%), #ccc var(--progress, 0%));
+}
+```
+
+2. **Add JavaScript**: Update the variable on the `input` event:
+```javascript
+if (!CSS.supports('accent-color')) {
+ const slider = document.getElementById('volume');
+ slider.addEventListener('input', (e) => {
+ e.target.style.setProperty('--progress', `${e.target.value}%`);
+ });
+}
+```