<article> (Self-contained piece)
Article Title
Article content goes here...
This page demonstrates accessible components using modern CSS, combining aesthetic design with inclusive principles.
Try this: Use the 'Tab' key to navigate. The "Skip to main content" link should appear first. The navigation links and theme toggle are focusable. Pressing 'Enter' on the skip link jumps you past the header.
This form uses :user-valid and :user-invalid CSS pseudo-classes for feedback, avoiding distracting error messages before user interaction. Error messages use aria-live.
Using HTML elements for their intended purpose gives inherent meaning and structure, crucial for assistive technologies and overall robustness.
<header> (Page/Site Banner)<main> (Primary Page Content)
<article> (Self-contained piece)
Article content goes here...
<section> (Themed group)Section content...
Visuals need text alternatives (alt text) so their content or function is accessible to users who cannot see them.
aria-label provides the text alternative for this CSS background image.
Empty aria-label="" marks this purely decorative graphic to be ignored by screen readers. Alternatively, assign role="presentation".
<figure> groups the graphic and its <figcaption>. aria-label still describes the graphic itself.
Settings Button Text
Icon font is hidden (`aria-hidden`). Accessible text provided via adjacent text or visually hidden span.
More Information
Inline SVG uses <title> (referenced by aria-labelledby) for its accessible name. `role="img"` clarifies its purpose. `focusable="false"` prevents redundant tab stops.
Sufficient contrast between text/UI elements and their background is crucial. Color should not be the only means of conveying information.
Regular Text (4.5:1+)
Large Text (3:1+)
Low Contrast
Low Contrast
This link uses an underline on hover/focus in addition to color difference.
Error: Using icon and bold text, not just red color.
Success: Using icon and bold text, not just green color.
ARIA (Accessible Rich Internet Applications) adds semantics where HTML lacks them, especially for dynamic content. Use native HTML first! ARIA live regions allow screen readers to announce changes without the user having to shift focus.
System Status:
Proper table markup (<caption>, <thead>, <th> with scope attributes) is essential for screen readers to interpret data relationships correctly.
| Feature | Chrome | Firefox | Safari | Edge |
|---|---|---|---|---|
| CSS Nesting | Yes | Yes | Yes | Yes |
| :has() Selector | Yes | Yes | Yes | Yes |
| Container Queries | Yes | Yes | Yes | Yes |
| View Transitions API | Partial | No | No | Partial |
| Overall Support | Varies by feature and browser version. | |||
Animations can cause issues for users with vestibular disorders, epilepsy, or cognitive impairments. Use the prefers-reduced-motion media query and provide controls where appropriate.
This toggle simulates the OS setting for demo purposes. Check your OS Accessibility settings to test prefers-reduced-motion directly.
Warning: By default, toggles don't support Enter as the activiation key. Use spacebar. Enter is reserved for form submission.
While native <details>/<summary> is often best, sometimes a custom accordion is needed. This requires careful use of ARIA attributes and JavaScript for keyboard interaction.
ARIA (Accessible Rich Internet Applications) is a set of attributes you can add to HTML elements to make web content and applications more accessible, especially when standard HTML semantics are insufficient (e.g., for complex custom widgets).
Use ARIA primarily to: Define roles for custom widgets (like menus, grids, sliders), add state information (like `aria-expanded`, `aria-selected`), define properties (like `aria-required`), build landmark regions if semantic HTML isn't used, and manage live regions. Always follow the ARIA Authoring Practices Guide (APG) patterns.
Remember the First Rule of ARIA: If a native HTML element has the semantics and behavior you need, use it instead!
Managing keyboard focus programmatically is crucial for accessible dynamic interfaces like modals, menus, and single-page applications.
(A real modal implementation requires significant JavaScript for focus trapping, state management, and ARIA attributes.)
When opened: