🐛 Improved toggle card accessibility for screen readers - #30002
🐛 Improved toggle card accessibility for screen readers#30002MHJahanbakhsh wants to merge 1 commit into
Conversation
fixes TryGhost#27462 Collapsed toggle content is no longer exposed to assistive tech, and the expand control exposes state via aria-expanded while keeping heading click and button keyboard activation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: QUIET Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (6)📚 Learning: 2026-06-04T15:15:20.265ZApplied to files:
📚 Learning: 2026-08-03T21:09:05.797ZApplied to files:
📚 Learning: 2026-01-08T10:26:38.700ZApplied to files:
📚 Learning: 2026-02-04T15:58:09.124ZApplied to files:
📚 Learning: 2026-04-09T09:44:26.783ZApplied to files:
📚 Learning: 2026-06-22T14:36:35.803ZApplied to files:
🪛 ast-grep (0.45.1)ghost/core/core/frontend/src/cards/js/toggle.js[warning] 43-43: Avoid using the initial state variable in setState (setstate-same-var) [warning] 81-81: Avoid using the initial state variable in setState (setstate-same-var) [error] 43-43: React's useState should not be directly called (usestate-direct-usage) [error] 81-81: React's useState should not be directly called (usestate-direct-usage) 🔇 Additional comments (8)
WalkthroughToggle cards now use semantic buttons with explicit expansion state and accessible labels. Collapsed content starts with Possibly related PRs
Suggested reviewers: Merge Risk: ⚪ Minimal · up to This localized accessibility update is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 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 |
Summary
kg-toggle-cardcontent:aria-expanded,aria-controls, and a clear accessible name on the toggle buttonhidden/aria-hidden/inert, synced by frontend JS withdata-kg-toggle-statekg-default-cardsandkg-default-nodes) and unit tests for consistent markupFixes #27462
Test plan
pnpm exec vitest run test/cards/toggle.test.tsinkoenig/kg-default-cardspnpm exec vitest run test/renderers/toggle-renderer.test.ts test/nodes/toggle.test.tsinkoenig/kg-default-nodes