Skip to content

Improve Accessibility to Align with Conventions #6

@SethPaul

Description

@SethPaul

Accessibility Improvements Needed

The current application needs significant accessibility improvements to align with web accessibility conventions and standards. After analyzing the codebase, several key areas were identified that need attention.

Missing Information

  • Specific accessibility standards (WCAG 2.0, 2.1, Section 508) should be defined
  • The required compliance level (A, AA, AAA) should be specified

Key Areas for Improvement

1. Semantic HTML and ARIA Attributes

Issues Found:

  • Content injected with {@html} lacks semantic structure (App.svelte, line 181)
  • Select dropdown missing label and aria-label (Chat.svelte, lines 54-59)
  • Form inputs missing proper labels (App.svelte, lines 186-193)

Recommended Changes:

  • Add proper form labels with 'for' attributes
  • Add ARIA roles, labels, and descriptions
  • Ensure content injected with {@html} has proper semantic structure

2. Keyboard Navigation

Issues Found:

  • Scrollable container lacks keyboard navigation (App.svelte, line 245)
  • Focus styles are minimal (global.css, lines 61-63)

Recommended Changes:

  • Add skip links for keyboard navigation
  • Improve focus styles to be more visible
  • Add keyboard event handlers for scrollable containers

3. Color Contrast

Issues Found:

  • Blue text on light background may have insufficient contrast (App.svelte, line 230)
  • Gradient backgrounds may create contrast issues (Chat.svelte, lines 73-76)

Recommended Changes:

  • Ensure all text has a contrast ratio of at least 4.5:1
  • Test colors with a contrast checker tool
  • Add solid backgrounds behind text on gradients if needed

4. ARIA Landmarks

Issues Found:

  • Chat section should be marked as a region or form (Chat.svelte, line 53)

Recommended Changes:

  • Add appropriate ARIA landmarks (nav, main, form, etc.)
  • Add aria-label attributes to landmarks for better screen reader identification

Implementation Example

Here's an example of how to improve the Chat component:

<\!-- Original -->
<div class="chat-section">
  <select class="role-selection" bind:value={selectedRole}>
    <option value="" disabled selected>Select Role</option>
    {#each group as person}
      <option value={person.role}>{person.name} ({person.role})</option>
    {/each}
  </select>

  <textarea class="chat-input" bind:value={message} 
    placeholder="Type your message" 
    rows="4" 
    style="width: 100%;"
    on:keydown={handleKeyPress}></textarea>
  <button on:click={sendMessage}>Send</button>
</div>

<\!-- Improved -->
<section class="chat-section" aria-labelledby="chat-section-heading">
  <h2 id="chat-section-heading" class="visually-hidden">Chat Interface</h2>
  
  <div class="form-group">
    <label for="role-selection">Select your character:</label>
    <select id="role-selection" class="role-selection" bind:value={selectedRole} aria-required="true">
      <option value="" disabled selected>Select Role</option>
      {#each group as person}
        <option value={person.role}>{person.name} ({person.role})</option>
      {/each}
    </select>
  </div>

  <div class="form-group">
    <label for="message-input">Your message:</label>
    <textarea 
      id="message-input"
      class="chat-input" 
      bind:value={message} 
      placeholder="Type your message" 
      rows="4"
      aria-describedby="message-help"
      on:keydown={handleKeyPress}></textarea>
    <small id="message-help">Press Enter to send or Shift+Enter for a new line</small>
  </div>
  
  <button 
    on:click={sendMessage}
    aria-disabled={\!selectedRole || \!message}
    disabled={\!selectedRole || \!message}>
    Send Message
  </button>
</section>

Testing Recommendations

  • Add automated accessibility testing with tools like axe-core
  • Add manual screen reader testing guidelines
  • Create an accessibility test checklist based on WCAG 2.1 AA criteria
  • Test with common screen readers (NVDA, JAWS, VoiceOver)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions