Skip to main content

Posts

Showing posts with the label WCAG

Preventing Focus Ring Clipping in Cards with `overflow: hidden`

  It is a pervasive conflict in UI architecture: your design system requires cards with rounded corners and full-bleed images, necessitating   overflow: hidden   and   border-radius . However, your accessibility requirements dictate a high-contrast focus indicator that extends beyond the component's perimeter. When you apply  overflow: hidden  to a container, it creates a hard clipping boundary. While standard CSS  outline  is painted outside the border edge, specific layout contexts (such as grid containers with their own overflow handling or transform layers) or the desire for  inset  focus styles often result in the focus indicator being chopped off or obscured by child content (like images). This results in a direct violation of  WCAG 2.4.7 (Focus Visible)  and often fails  WCAG 2.4.13 (Focus Appearance)  regarding contrast and size requirements. Here is the architectural root cause and the robust, component-level...