Skip to main content

Posts

Showing posts with the label HTML

Solving ':focus-visible' Outline Clipping in Overflow-Hidden Bento Grids

  The "Bento" grid design trend—characterized by modular, card-based layouts with heavy corner rounding—has introduced a subtle but pervasive accessibility regression. To achieve the signature Bento look, developers instinctively apply  overflow: hidden  to card containers. This ensures that background images, videos, or child elements strictly adhere to the parent's  border-radius . However, this architectural decision creates a conflict with the CSS Box Model: standard focus outlines are rendered  outside  the border edge. When  overflow  is hidden, the browser clips the focus ring, rendering it invisible or partially cut off. This results in a direct violation of  WCAG 2.4.7 (Focus Visible)  and often fails  WCAG 2.2 SC 2.4.11 (Focus Appearance)  due to insufficient contrast area. Below is the root cause analysis and the architectural pattern to resolve this without compromising the design system. The Root Cause: The Paint O...

HTMX Out-of-Band Swaps: Managing Shared State Without a Client-Side Store

  One of the most persistent friction points when moving from a Single Page Application (SPA) architecture back to server-side rendering is "Action at a Distance." In a React/Redux context, updating a shopping cart count in the navbar when a user clicks a button in the footer is trivial: dispatch an action, update the store, and let the components re-render. In a traditional request/response cycle, this usually implies a full page reload. HTMX offers a mechanism to solve this without client-side state management or page reloads:  Out-of-Band (OOB) Swaps . The Architecture Mismatch The root cause of this difficulty lies in the fundamental constraint of standard HTTP interactions:  One Request, One Response, One Update. When using HTMX in its default state, a user interaction (like a click) triggers an AJAX request. The server returns a snippet of HTML, and HTMX swaps that snippet into a specific  target  in the DOM. The problem arises when a single action impacts...