Focuswithin
Focus-within is a CSS pseudo-class that matches an element if any element inside it currently has focus. It is part of CSS Selectors Level 4 and is used to style a container when a descendant receives keyboard focus. This helps create visible focus cues for users navigating with keyboards or assistive devices.
How it works: When any descendant element that can receive focus is focused, the host element matches
Usage examples: .card:focus-within { outline: 2px solid blue; } This enables highlighting a group when any inner element
Considerations: :focus-within applies to elements that contain focusable descendants and does not require the container to
Browser support: Supported in all major modern browsers. For older environments, developers may rely on JavaScript