Skip to main content

Do Not Cause Context Change When an Input Setting Changes (Without Warning)

Disabilities Affected: Cognitive, Mobility, Visual
Success Criterion: 3.2.2
Level: A
Changing the setting of any user interface component (like selecting a radio button, checking a box, entering text) must not automatically cause a change of context unless the user has been advised of the behavior before using the component.

Why It Matters

Similar to “On Focus,” unexpected changes triggered merely by interacting with a control (before explicitly submitting or confirming) can be disorienting. Users may accidentally trigger actions while exploring options or making selections, leading to confusion, data loss, or navigation errors.

Fixing the Issue

Avoid triggering context changes directly from onchange, onclick (for checkboxes/radio buttons), or similar events on form elements. Actions like submitting forms, navigating, or significantly changing layout should typically wait for an explicit activation command, like clicking a “Submit,” “Go,” or “Update” button. If a component must trigger a change on input (e.g., a dropdown that reloads part of the page), clearly explain this behavior in text before the component so the user anticipates it.


Good Code Example

A dropdown that filters content, triggered by a separate button:

  • <label for="category-select">Filter by Category:</label>
    <select id="category-select" name="category">
      <option value="all">All</option>
      <option value="electronics">Electronics</option>
      <option value="clothing">Clothing</option>
    </select>
    <button type="button" onclick="applyFilter()">Apply Filter</button>
    
    <div id="results">
      </div>
    
    <script>
      function applyFilter() {
        const selectedCategory = document.getElementById('category-select').value;
        console.log("Filtering results for:", selectedCategory);
        // Logic to update the content in the #results div based on selection
        // This change of context is expected because the user clicked "Apply Filter".
      }
    </script>

Bad Code Example

A select dropdown that automatically navigates when an option is chosen:

  • <label for="nav-select">Go to:</label>
    <select id="nav-select" name="section" onchange="window.location.href=this.value">
      <option value="">Select...</option>
      <option value="/">Home</option>
      <option value="/about">About Us</option>
      <option value="/contact">Contact</option>
    </select>
Search Ultimate Guide
Tablet displaying an eBook cover titled 'Integrating Accessibility Compliance Into Your Budget' by AccessiTREE. The cover features a digital tree with accessibility-related icons, symbolizing inclusive design and compliance.
Free eBook
Integrating Accessibility Compliance Into Your Budget
A Practical Guide for Healthcare Leaders Navigating the New HHS Ruling

Need Help with Compliance?
Our team is here to guide you through the process of meeting accessibility standards. Contact us today to get started.