fix(a11y): increase sidebar text contrast to meet WCAG AA accessibility#5819
Conversation
|
|
@anusha-c18 is attempting to deploy a commit to the HeroUI Inc Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughRemoved the dark mode text color utility class "dark:text-default-300" from the table of contents component styling to improve color contrast compliance with WCAG AA accessibility standards for inactive navigation items. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/docs/components/docs/toc.tsx (1)
93-94: Consider removing redundant dark mode class.Line 94's
dark:data-[active=true]:text-foregroundis redundant since line 93 already appliestext-foregroundto active items regardless of mode.Apply this diff to remove the redundancy:
"data-[active=true]:text-foreground", - "dark:data-[active=true]:text-foreground", "before:content-['']",
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/docs/components/docs/toc.tsx(1 hunks)
🔇 Additional comments (2)
apps/docs/components/docs/toc.tsx (2)
92-92: Excellent accessibility fix!Removing
dark:text-default-300and relying ontext-default-500for both light and dark modes is the correct approach to meet WCAG AA contrast requirements. The reported 7.8:1 contrast ratio significantly exceeds the 4.5:1 minimum for normal text.
120-120: Verify dark mode contrast for “Back to top” link
Thedark:text-foreground/30opacity may fall below the 4.5:1 WCAG AA threshold against the TOC background. Confirm it meets contrast requirements using your actual theme values. Also scan for other low-opacity dark-mode text, for example:rg -n 'dark:text-foreground/[0-9]+' apps/docs/ rg -n 'dark:text-default-300' apps/docs/
@heroui/accordion
@heroui/alert
@heroui/autocomplete
@heroui/avatar
@heroui/badge
@heroui/breadcrumbs
@heroui/button
@heroui/calendar
@heroui/card
@heroui/checkbox
@heroui/chip
@heroui/code
@heroui/date-input
@heroui/date-picker
@heroui/divider
@heroui/drawer
@heroui/dropdown
@heroui/form
@heroui/image
@heroui/input
@heroui/input-otp
@heroui/kbd
@heroui/link
@heroui/listbox
@heroui/menu
@heroui/modal
@heroui/navbar
@heroui/number-input
@heroui/pagination
@heroui/popover
@heroui/progress
@heroui/radio
@heroui/ripple
@heroui/scroll-shadow
@heroui/select
@heroui/skeleton
@heroui/slider
@heroui/snippet
@heroui/spacer
@heroui/spinner
@heroui/switch
@heroui/table
@heroui/tabs
@heroui/toast
@heroui/tooltip
@heroui/user
@heroui/react
@heroui/system
@heroui/system-rsc
@heroui/theme
@heroui/use-aria-accordion
@heroui/use-aria-accordion-item
@heroui/use-aria-button
@heroui/use-aria-link
@heroui/use-aria-modal-overlay
@heroui/use-aria-multiselect
@heroui/use-aria-overlay
@heroui/use-callback-ref
@heroui/use-clipboard
@heroui/use-data-scroll-overflow
@heroui/use-disclosure
@heroui/use-draggable
@heroui/use-form-reset
@heroui/use-image
@heroui/use-infinite-scroll
@heroui/use-intersection-observer
@heroui/use-is-mobile
@heroui/use-is-mounted
@heroui/use-measure
@heroui/use-pagination
@heroui/use-real-shape
@heroui/use-ref-state
@heroui/use-resize
@heroui/use-safe-layout-effect
@heroui/use-scroll-position
@heroui/use-ssr
@heroui/use-theme
@heroui/use-update-effect
@heroui/use-viewport-size
@heroui/aria-utils
@heroui/dom-animation
@heroui/framer-utils
@heroui/react-rsc-utils
@heroui/react-utils
@heroui/shared-icons
@heroui/shared-utils
@heroui/stories-utils
@heroui/test-utils
commit: |
Closes #5818
📝 Description
This PR fixes a low-contrast accessibility issue in the
On this pageside navigation of HeroUI docs.Inactive sidebar link text previously had insufficient contrast against dark backgrounds, failing WCAG 2.1 Level AA requirements.
The colour has been updated to provide a compliant contrast ratio for improved readability and accessibility.
⛳️ Current behavior (updates)
Non-active (unselected) links use the light gray
(hsl(--heroui-default-300)colour, resulting in a contrast ratio of ~2.6:1 against the dark background, which fails WCAG 2.1 Level AA accessibility standards for normal text.🚀 New behavior
Updated the colour to
text-default-500for both light and dark modes, resulting in a contrast ratio of 7.8 : 1, meeting WCAG 2.1 AA guidelines for normal text.💣 Is this a breaking change (Yes/No):
No
📝 Additional Information
Before:
After
Summary by CodeRabbit