Last active
August 6, 2025 00:44
-
-
Save KirillTregubov/d7db4002b9097e47ea8e3cf822e25e5a to your computer and use it in GitHub Desktop.
Tailwind utility for minimum WCAG AAA Target Size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* More info: https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=If%20the%20target%20is%20the,44%20by%2044%20CSS%20pixels.&text=A%20footnote%20or%20an%20icon,from%20the%20minimum%20target%20size */ | |
/* touch-hitbox or pointer-coarse:touch-hitbox (mobile-only) */ | |
@utility touch-hitbox { | |
position: relative; | |
&:before { | |
content: ""; | |
cursor: pointer; | |
position: absolute; | |
display: block; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
width: 100%; | |
height: 100%; | |
min-height: 44px; | |
min-width: 44px; | |
z-index: 9999; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment