TouchTargetEnforcer
ImplementedA11y utility wrapper (DS-CORR-08-10) enforcing the 44×44px tap-target floor (WCAG 2.5.5). Wraps any interactive child (button/a/label) in an inline-flex span using the --ep-tap-min CSS variable via tapTargetStyle; negative margins compensate so the wrapper never expands the visual footprint — it is purely a hit-area expander.
src/components/atoms/TouchTargetEnforcer/TouchTargetEnforcer.tsxA11y utility wrapper (DS-CORR-08-10) enforcing the 44×44 px tap-target floor (WCAG 2.5.5). Wraps any interactive child (button / a / label) in an inline-flex span using the --ep-tap-min CSS variable via tapTargetStyle; negative margins compensate so the wrapper never expands the visual footprint — it is purely a hit-area expander. FR-CA : « Garantit la zone de toucher 44×44 px sans modifier le visuel de l'enfant ».
TouchTargetEnforcer
Atom — A11y utility (Family 2: Display Atoms, DS-CORR-08-10)
Wrapper is `role="presentation"` (transparent in the a11y tree) and never `aria-hidden` (which would hide the focusable child — an axe aria-hidden-focus serious violation). Taps landing in the expanded margin are forwarded to the child via a synthetic `.click()`; clicks that already landed on the child itself are not re-dispatched. The child keeps its own keyboard activation path intact.
This component supports light and dark mode.
Props
children*React.ReactElementSingle interactive child (button / a / label). The wrapper requires exactly one DOM-root child at runtime; multi-root React trees are silently ignored by the forwarder.
as'span' | 'div''span'Wrapper tag. Use `'div'` when the child is block-level so the wrapper participates in the surrounding block layout.
classNamestring''Additional classes for the wrapper. Applied after the built-in `inline-flex items-center justify-center -m-2` cluster.
layoutCompensationstring''Tailwind margin fragments so the wrapper does not push surrounding layout. Pass an empty string when the child already supplies its own padding.
Props
TouchTargetEnforcer
childrenReact.ReactElement—The interactive child to enlarge the hit-rectangle of
as'span' | 'div''span'Wrapper tag — use 'div' for block-level children
classNamestring''Additional classes for the wrapper
layoutCompensationstring''Tailwind margin fragments so the wrapper doesn't push surrounding layout
<TouchTargetEnforcer />Accessibility
a11y
1 ruleUsage
Import
import { TouchTargetEnforcer } from "@epasslive/design-system"Example 1
<TouchTargetEnforcer><button aria-label="Close">×</button></TouchTargetEnforcer>