Skip to content

Accessibility: Form labels disconnected from inputs on Edit Profile page #12554

@shaiksahilrizwan

Description

@shaiksahilrizwan

Problem

Found while testing Edit Profile for accessibility (#4914).

On the Edit Profile page, the form labels for the Website and Description fields are not programmatically connected to their corresponding input fields. The <label> elements use for attributes, but the inputs are missing the corresponding id attributes. This prevents screen readers from announcing the field names when users navigate to them via keyboard.

Relevant URL: https://openlibrary.org/people/firecrack?m=edit

Reproducing the bug

  1. Go to your Edit Profile page.
  2. Inspect the "website" input element (which has name="website#0").
  3. Inspect the "Description" textarea (which has name="description").
  • Expected behavior: Form inputs should have id attributes that exactly match their label's for attribute so they compute an accessible name correctly.
  • Actual behavior: The inputs lack id attributes, breaking the connection to their labels.

Context

  • Browser (Chrome, Safari, Firefox, etc): [Insert your browser, e.g., Chrome]
  • OS (Windows, Mac, etc): [Insert your OS, e.g., Windows]
  • Logged in (Y/N): Y
  • Environment (prod, dev, local): prod

Breakdown

Implementation Details (for maintainers)

Update the HTML templates for these fields to make them accessible:

  • Description Field: Add id="description" to match the label's for attribute.
  • Website Field: Since this is a repeating field (unique=False branch in the macro), we need to ensure valid HTML. The first input (i==0) should get id="website" to match the <label for="website">. Any dynamically added subsequent inputs (i>0) should get an aria-label="Website" to remain accessible without duplicating the ID.

Requirements Checklist

  • Add id="description" to the textarea in openlibrary/templates/type/user/edit.html.
  • Modify openlibrary/macros/UserEditRow.html so the first website input gets id="website".
  • Modify openlibrary/macros/UserEditRow.html so subsequent website inputs get aria-label="Website".

Related files

  • openlibrary/templates/type/user/edit.html
  • openlibrary/macros/UserEditRow.html

Stakeholders


Instructions for Contributors

  • Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

Metadata

Metadata

Labels

Lead: @RayBBIssues overseen by Ray (Onboarding & Documentation Lead) [manages]Theme: AccessibilityWork related to disability accessibility. [managed]Type: BugSomething isn't working. [managed]

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions