fix description for group not read by screenreaders#4198
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Fieldset component now properly connects its fieldset container to its legend and description elements via ARIA attributes. The fieldset receives an ChangesFieldset ARIA Accessibility
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/app-components/Label/Fieldset.tsx`:
- Around line 73-77: Fieldset is composing ARIA and element ids from an optional
FieldsetProps.id which can produce "undefined-legend"/duplicate ids; update the
component so it only emits and references ids when a valid id exists (or
generate a stable fallback via React's useId) and build
aria-labelledby/Legend/Descr ids conditionally—i.e., when setting
aria-labelledby, only include `${id}-legend` and `${id}-description` if id is
truthy, and likewise only pass id props to DesignsystemetFieldset.Legend and the
description element when id is present (or use the fallback useId value) so no
"undefined-*" ids are emitted; apply the same conditional handling where ids are
set around lines with DesignsystemetFieldset.Legend and the corresponding
description element.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 829df87d-7539-41b5-9792-ee8a8613b087
📒 Files selected for processing (1)
src/app-components/Label/Fieldset.tsx
lassopicasso
left a comment
There was a problem hiding this comment.
Ser bra ut :) Jeg vet ikke om det CodeRabbit varsler om, er noe du skal se på.
|



Description
Solved by adding both legend and description to an "aria-labelledby" as suggested by designsystemet in digdir/designsystemet#4662 (comment)
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit