Keep your coding agent up to date with the latest web best practices
Release v0.0.159
github-actions[bot]6272f7767d26
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex ab6a76f..7d1d810 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-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.158"+ "version": "0.0.159"}]}diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex ade8f83..eae9d92 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.158",+ "version": "0.0.159","author": {"name": "Google Chrome"}diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.jsonindex ade8f83..eae9d92 100644--- a/.cursor-plugin/plugin.json+++ b/.cursor-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.158",+ "version": "0.0.159","author": {"name": "Google Chrome"}diff --git a/README.md b/README.mdindex d59735f..ca88e21 100644--- a/README.md+++ b/README.md@@ -26,7 +26,7 @@ Our content is evergrowing, we cover the bleeding edge of the web platform as we### Core disciplines-Here's a tiny sampling of the **127 use-case-centric guides**:+Here's a tiny sampling of the **128 use-case-centric guides**:* **User Experience**: Smooth and modern visual states: View Transitions, CSS `scrollbar-color` styling, high-contrast adaptation, entry/exit transition animations, parallax scrolling.* **CSS layout:** container queries (both size and style queries), modern color spaces (`oklch`, `color-mix`) and `subgrid`, text-wrap tuning (`balance`, `pretty`), subgrid, and typography line height trimming (`text-box`)@@ -36,10 +36,10 @@ Here's a tiny sampling of the **127 use-case-centric guides**:* **Accessibility & Security**: accessible error announcements, keyboard focus management.* **Built-in AI**: Leveraging local, on-device client models (native Language Detection, Summarization, and Translation APIs).-#### Full Skill Coverage (v0.0.158)+#### Full Skill Coverage (v0.0.159)<details>-<summary>Includes expert guidance across <strong>100 modern web features</strong></summary>+<summary>Includes expert guidance across <strong>102 modern web features</strong></summary>- [::backdrop](https://web-platform-dx.github.io/web-features-explorer/features/backdrop/)- [:autofill](https://web-platform-dx.github.io/web-features-explorer/features/autofill/)@@ -100,6 +100,8 @@ Here's a tiny sampling of the **127 use-case-centric guides**:- [Mutually exclusive <details> elements](https://web-platform-dx.github.io/web-features-explorer/features/details-name/)- [Navigation API](https://web-platform-dx.github.io/web-features-explorer/features/navigation/)- [navigator.modelContext](https://web-platform-dx.github.io/web-features-explorer/features/navigator-modelcontext/)+- [overflow-clip-margin](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip-margin/)+- [overflow: clip](https://web-platform-dx.github.io/web-features-explorer/features/overflow-clip/)- [overlay](https://web-platform-dx.github.io/web-features-explorer/features/overlay/)- [overscroll-behavior](https://web-platform-dx.github.io/web-features-explorer/features/overscroll-behavior/)- [Page visibility](https://web-platform-dx.github.io/web-features-explorer/features/page-visibility/)@@ -144,7 +146,7 @@ Here's a tiny sampling of the **127 use-case-centric guides**:</details><details>-<summary>Covers <strong>127 real-world developer use cases</strong> with production-ready code patterns</summary>+<summary>Covers <strong>128 real-world developer use cases</strong> with production-ready code patterns</summary><h3>accessibility</h3>@@ -260,6 +262,7 @@ Here's a tiny sampling of the **127 use-case-centric guides**:- **[model-partial-time-concepts](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/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.- **[move-dom-element-without-losing-state](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/move-dom-element-without-losing-state.md)**: Move or reparent a DOM element without losing important element state, such as interactivity states (:focus/:active), <iframe> loading state, animation/transition state, etc- **[navigation-drawer](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/navigation-drawer.md)**: Create a navigation drawer component that, when triggered from a menu button, slides in from the side overlayed on top of existing page content, and slides out when dismissed (by swiping away, tapping outside, or pressing escape).+- **[overflow-clipping-control](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/overflow-clipping-control.md)**: Adjust the visible clipping boundary of an element to align with the content edge, padding edge, or border edge—or a specified offset from any of these—offering finer-grained control over how content is clipped.- **[parallax-scroll-effects](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/parallax-scroll-effects.md)**: Create scroll-based effects (such as parallax) where foreground and background layers move at different rates, creating a sense of depth as the user scrolls.- **[persistent-app-tours](https://github.com/GoogleChrome/modern-web-guidance/blob/main/skills/modern-web-guidance/guides/user-experience/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/user-experience/persistent-toast-notifications.md)**: Create non-intrusive toast and overlay notifications for persistent, stackable messaging and state communication.diff --git a/gemini-extension.json b/gemini-extension.jsonindex ade8f83..eae9d92 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.158",+ "version": "0.0.159","author": {"name": "Google Chrome"}diff --git a/package.json b/package.jsonindex 8acbd71..031372d 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.158",+ "version": "0.0.159","publisher": "GoogleChrome","engines": {"vscode": "^1.90.0",diff --git a/skills/modern-web-guidance/guides/user-experience/overflow-clipping-control.md b/skills/modern-web-guidance/guides/user-experience/overflow-clipping-control.mdnew file mode 100644index 0000000..5774cda--- /dev/null+++ b/skills/modern-web-guidance/guides/user-experience/overflow-clipping-control.md@@ -0,0 +1,180 @@+# Overflow Clipping Control++While `overflow: hidden` is a "blunt instrument" that almost always clips content strictly at the padding-box, `overflow: clip` combined with `overflow-clip-margin` provides the "scalpel" for fine-grained layout control across block containers.++Specify exactly where clipping occurs with `overflow: clip` and `overflow-clip-margin`. You can align the boundary precisely with inner box-model edges or extend the clipping boundary beyond the element's box by a specified offset (a safety margin). This modern approach is highly performant and eliminates the legacy requirement of adding extra wrapper containers with custom padding and negative margins just to let visual effects (like prominent child element shadows) render unclipped.++Replaced elements (`<img>`, `<video>`, `<canvas>`, etc.) default to `overflow: clip` and `overflow-clip-margin: content-box`, giving you control to cleanly contain images that use `object-fit` or `border-radius`.++## How to Implement++1. **Apply `overflow: clip`**: Ensure the target element has `overflow: clip` enabled. Setting `overflow: clip` is **mandatory** on block layout containers for `overflow-clip-margin` to take effect. If `overflow` is set to `hidden`, `auto`, or `scroll`, the `overflow-clip-margin` property is ignored by the browser. `overflow: clip` prevents all scrolling (both user-initiated and programmatic via JavaScript).+2. **Align to a Box-Edge**: Use keywords to precisely align the clipping boundary to inner box-model edges:+ - `content-box`: Clips content exactly where the content area begins, leaving the padding area completely clean. Content stops right at the padding's edge. Excellent for nested layout modules.+ - `padding-box` (Default): Clips content at the inner edge of the border.+ - `border-box`: Clips content at the outer edge of the border, allowing content to sit under or partially overlap a translucent border.+3. **Define a Specified Offset (The Bleed)**: Provide a length value (e.g., `15px` or `5px`) to create a safety zone before cutting pixels. This allows prominent child element shadows to render unclipped past the boundary edge without expanding layout geometry.+4. **Combine Box-Edge and Offset**: Specify both a box edge and a length offset simultaneously (e.g., `content-box 15px`) to offset from a specific box edge.++## Example Code++The following examples demonstrate dynamic container layout controls, showcasing automated inner content curve nested framing and child element shadow protection alongside progressive enhancement fallbacks.++### Block Containers: Nested Rounded Curves++* Apply `overflow-clip-margin: content-box` to a parent container with rounded corners and custom padding.+* Apply similar rounded corners on inner child media and footer components along the concentric inner content box boundary, solving awkward nesting curves without custom `calc()` logic.++```html+<div class="nested-curve-parent">+ <img src="avatar.jpg" alt="Nested Curve Demo">+ <div class="nested-curve-footer">Card Footer</div>+</div>+```++```css+/**+ * Standard block layout container with outer corner radii and padding.+ * Keeps base level 1 fallback clipping roughly at the inner padding box.+ */+.nested-curve-parent {+ /* Level 1 Fallback: clips child roughly at the padding box */+ overflow: hidden;+}++/* Inner footer component with 12px rounded to visually demonstrate automatic concentric corner clipping */+.nested-curve-footer {+ background: #111;+ color: #fff;+}++@supports (overflow-clip-margin: content-box) {+ .nested-curve-parent {+ /* MANDATORY: overflow: clip is required on non-replaced elements */+ overflow: clip;+ /* Automatically curves clipping edge to match inner content-box radius */+ overflow-clip-margin: content-box;+ }+}+```++### Block Containers: Child Element Shadow Bleed++* Apply `overflow: clip` and define an extended `overflow-clip-margin` length offset to create a visible safety zone permitting the child's shadow to render unclipped outside the parent container without altering layout geometry. Without this, the child's shadow is clipped at the parent's boundary.++```html+<div class="safety-zone-parent">+ <h4>Clipped Container</h4>+ <p>Inner content boundaries safely contained.</p>+ <!-- Child button element positioned inside with a prominent shadow -->+ <button class="demo-glowing-btn">Submit</button>+</div>+```++```css+/**+ * Standard block layout container clipping inner content.+ * Base fallback uses overflow: hidden, which abruptly slices child element shadows.+ */+.safety-zone-parent {+ /* Level 1 Fallback: clips overflowing content but truncates child shadows */+ overflow: hidden;+}++/* Child button element positioned inside with an expanded shadow */+.demo-glowing-btn {+ display: block;+ box-shadow: 0 8px 13px rgba(229, 46, 113, 0.7);+}++@supports (overflow-clip-margin: 15px) {+ .safety-zone-parent {+ overflow: clip;+ /* Establishes a visible safety zone allowing child element shadows to render safely outside */+ overflow-clip-margin: 15px;+ }+}+```++## Strategic Implementation & Best Practices++- **DO** apply `overflow: clip` on target elements when utilizing `overflow-clip-margin`, as setting `overflow` strictly to `clip` is **mandatory** on standard block layout containers to activate custom or inner curved clip margins.+- **DO** set `overflow-clip-margin: content-box` on padded containers with rounded corners to automatically clip unrounded internal child elements into mathematically perfect nested border curves without manual padding subtraction logic.+- **DO** configure `overflow-clip-margin` with a specified length offset when applying external visual effects (like `filter: drop-shadow()`) to prevent sharp bounding box truncation without altering or expanding layout geometry.+- **DO NOT** apply `overflow: clip` if the container requires programmatic scroll manipulation via JavaScript or serves as the immediate layout context for `position: sticky` elements, as `clip` completely disables scrolling.++## Fallback Strategies++Baseline status for overflow: clip: Widely available. It's been Baseline since 2022-09-12.+Supported by: Chrome 90 (Apr 2021), Edge 90 (Apr 2021), Firefox 81 (Sep 2020), and Safari 16 (Sep 2022).+overflow-clip-margin has limited availability.+Supported by: Firefox 148 (Feb 2026).+Unsupported in: Chrome, Edge, and Safari.++For target environments lacking native support for `overflow: clip` or `overflow-clip-margin`, progressive enhancement fallback strategies depend directly on the visual intent:+- Fallback to `overflow: hidden` as the base experience to guarantee core boundaries are maintained.+- Fallback to `overflow: visible` on elements where drop-shadows or external corner badges must not be truncated.++### Complete Progressive Enhancement Fallback Implementation++```html+<!-- 1. Nested rounded edges fallback -->+<div class="demo-container-fallback">+ <img src="example.jpg" alt="Nested Curve Fallback">+ <div class="demo-footer-fallback">Footer</div>+</div>++<!-- 2. Child element shadow bleed fallback -->+<div class="demo-safety-parent">+ <h4>Container</h4>+ <p>Inner boundaries contained.</p>+ <button class="demo-glowing-btn">Submit</button>+</div>+```++```css+/**+ * 1. Block Container Nested Curves Fallback+ * Keeps base level 1 fallback clipping roughly at the inner padding box.+ */+.demo-container-fallback {+ /* Level 1 Fallback: clip child roughly at padding box */+ overflow: hidden;+}++.demo-container-fallback img {+ object-fit: cover;+ display: block;+}++@supports (overflow-clip-margin: content-box) {+ .demo-container-fallback {+ overflow: clip;+ overflow-clip-margin: content-box;+ }+}++/**+ * 2. Child Element Shadow Bleed Fallback+ * Base fallback clips content using overflow: hidden, abruptly truncating child element shadows.+ */+.demo-safety-parent {+ /* Level 1 Fallback */+ overflow: hidden;+}++.demo-glowing-btn {+ display: block;+ width: 100%;+ padding: 6px 12px;+ background: #e52e71;+ box-shadow: 0 8px 13px rgba(229, 46, 113, 0.65);+}++@supports (overflow-clip-margin: 15px) {+ .demo-safety-parent {+ overflow: clip;+ overflow-clip-margin: 15px;+ }+}+```\ No newline at end of file