📌 Description
Card (src/components/Card.tsx) always renders a div, and it's reused as the root wrapper for dashboard sections (QuoteForm, MetricsBar's loading/error states, PoolsPanel) that are conceptually distinct page regions. Rendering these as generic divs misses an easy opportunity to expose semantic landmarks (section, article) to assistive tech and to tools like a browser's accessibility tree/outline.
🧩 Requirements and context
- Add an optional
as prop to Card (defaulting to "div", preserving current behavior) allowing callers to render section, article, or another sanctioned tag.
- No visual/styling change for existing call sites that don't pass
as.
- Update at least one real call site (e.g.
QuoteForm's wrapping Card) to use as="section" with an appropriate aria-label/aria-labelledby, as a proof of the new capability.
🛠️ Suggested execution
- Update
src/components/Card.tsx to accept an as prop and render the corresponding element while keeping className/children behavior identical.
- Update
src/components/QuoteForm.tsx's Card usage to pass as="section" with a label tied to its existing heading.
- Extend
src/components/Card.test.tsx and src/components/QuoteForm.test.tsx to cover the new prop.
✅ Acceptance criteria
🔒 Security notes
No new attack surface; a semantic/accessibility refactor.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
Card(src/components/Card.tsx) always renders adiv, and it's reused as the root wrapper for dashboard sections (QuoteForm,MetricsBar's loading/error states,PoolsPanel) that are conceptually distinct page regions. Rendering these as genericdivs misses an easy opportunity to expose semantic landmarks (section,article) to assistive tech and to tools like a browser's accessibility tree/outline.🧩 Requirements and context
asprop toCard(defaulting to"div", preserving current behavior) allowing callers to rendersection,article, or another sanctioned tag.as.QuoteForm's wrappingCard) to useas="section"with an appropriatearia-label/aria-labelledby, as a proof of the new capability.🛠️ Suggested execution
src/components/Card.tsxto accept anasprop and render the corresponding element while keepingclassName/childrenbehavior identical.src/components/QuoteForm.tsx'sCardusage to passas="section"with a label tied to its existing heading.src/components/Card.test.tsxandsrc/components/QuoteForm.test.tsxto cover the new prop.✅ Acceptance criteria
asprop, defaulting to the currentdivbehavior.🔒 Security notes
No new attack surface; a semantic/accessibility refactor.
📋 Guidelines