fix(Modal/Slideover): suppress aria-describedby warning when no description#6242
fix(Modal/Slideover): suppress aria-describedby warning when no description#6242
Conversation
📝 WalkthroughWalkthroughThe changes address an accessibility warning that appeared in Modal and Slideover components when the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
🧹 Nitpick comments (1)
src/runtime/components/Modal.vue (1)
147-147: Add regression coverage for the no-description branch.This line is the core fix path, but current accessibility tests shown in context only assert the described case. Please add tests for “no
descriptionprop and nodescriptionslot” to lock in warning-free behavior.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/runtime/components/Modal.vue` at line 147, Add a regression test for the Modal component covering the "no description" branch: mount the Modal without the description prop and without providing a description slot (the branch controlled by the :aria-describedby expression in Modal.vue) and assert that aria-describedby is not present (or equals undefined) and that no accessibility or console warnings are emitted. Create this in the Modal test suite (e.g., Modal.spec) using the same render/mount helpers as other tests, spy on console.warn/error, mount <Modal> with no description prop and no description slot, and assert no warnings and that the rendered root does not include an aria-describedby attribute or includes it only as undefined. Ensure the test mirrors the existing "described" case structure so CI will exercise the regression path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/runtime/components/Modal.vue`:
- Line 147: Add a regression test for the Modal component covering the "no
description" branch: mount the Modal without the description prop and without
providing a description slot (the branch controlled by the :aria-describedby
expression in Modal.vue) and assert that aria-describedby is not present (or
equals undefined) and that no accessibility or console warnings are emitted.
Create this in the Modal test suite (e.g., Modal.spec) using the same
render/mount helpers as other tests, spy on console.warn/error, mount <Modal>
with no description prop and no description slot, and assert no warnings and
that the rendered root does not include an aria-describedby attribute or
includes it only as undefined. Ensure the test mirrors the existing "described"
case structure so CI will exercise the regression path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6a27825a-39a3-4e91-a895-7b73da06de14
📒 Files selected for processing (2)
src/runtime/components/Modal.vuesrc/runtime/components/Slideover.vue
Fixes #6240
Reka UI warns
Missing 'Description' or 'aria-describedby="undefined"'whenDialogContenthas noDialogDescriptionchild. The fix is to passaria-describedby="undefined"to suppress it when no description is intentionally provided.Added the conditional binding to both
Modal.vueandSlideover.vue— when description prop and slot are both absent, set it; otherwise leave it unset so reka-ui can wire it to theDialogDescriptionid normally.