mpaiva / CRDC-DSRC

Accessibility Assessment for Civil Rights Data Collection Data Submission Resource Center
0 stars 0 forks source link

Contact Us: Make "disabled" inputs "readonly" #13

Open mpaiva-aem opened 6 months ago

mpaiva-aem commented 6 months ago

image

Navigation for screen-reader and keyboard only users often depends on focus order. Since disabled fields are removed from the focus order, they can't be navigated to using keyboard shortcuts, which are a primary mode of navigation for many AT users.

Here is how to make text inputs read-only, ensuring users can't change the content but still allowing the inputs to be recognized by assistive technologies.

image

Code fix example for City field

<label for="edit-city" class="usa-label control-label">City (Read only)</label>
<input 
    autocomplete="" 
    data-drupal-selector="edit-city" 
    type="text" 
    id="edit-city" 
    name="city" 
    value="" 
    size="60" 
    maxlength="30" 
    placeholder="City" 
    class="form-text usa-input bg-base-lightest" 
    aria-readonly="true"
    readonly >