Skip to content

[A11Y-196] Associate the link text label with its input - #530

Merged
dancormier merged 2 commits into
mainfrom
codex/a11y-196-link-text-label
Sep 17, 2026
Merged

dancormier merged 2 commits into
mainfrom
codex/a11y-196-link-text-label

Conversation

@alexwarren

@alexwarren alexwarren commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Jira: https://stackoverflow.atlassian.net/browse/A11Y-196
Companion Stack Overflow PR: https://github.com/StackEng/StackOverflow/pull/26194

Summary

  • Correct the shared editor link dialog association for the visible Link text label.
  • Add regression coverage for both visible labels.
  • Add a patch changeset for release.

Before and after

Run npm start and use the editor at the local address shown in the output, normally http://localhost:8080/. Test main first, then this PR branch, with a screen reader enabled.

Before (main)

  1. Open the rich-text editor and open the Link dialog from the toolbar.
  2. Move focus from the URL field to the Link text field.

Expected baseline: Link text is visible, but its label points to a different element ID. A screen reader therefore does not announce Link text as the field name.

After (this PR)

Repeat the steps and confirm:

  • The first field is announced as the link URL field.
  • The second field is announced as Link text.
  • Typing and saving a link still produce the same link text and destination.
  • The visual layout is unchanged.

Screenshot evidence

The A11Y-196 Jira ticket contains the original SO_49 screenshots. No after screenshot is included because this is a programmatic label association with no intentional visual change; the screen-reader announcement is the before/after evidence.

Ticket checklist

  • Link text has a programmatic label matching its visible label.
  • Shared implementation covers question and article editors once the patch release is consumed.

Verification

  • npm run test:unit -- --runInBand (1,093 passing)
  • npm run lint (passes; two existing warning-only tests)
  • npm run build (passes with existing bundle-size warnings)
  • git diff --check

@changeset-bot

changeset-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f2262bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stackoverflow/stacks-editor Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploy Preview for stacks-editor ready!

Name Link
🔨 Latest commit f2262bd
🔍 Latest deploy log https://app.netlify.com/projects/stacks-editor/deploys/6aaab6d3eec029000862e7f2
😎 Deploy Preview https://deploy-preview-530--stacks-editor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Strengthen the regression test to verify each label targets its intended input.

Pull request overview

This PR fixes the shared link editor’s “Link text” label association, adds regression coverage, and includes a patch changeset.

Changes:

  • Corrects the text input ID.
  • Adds label association tests.
  • Adds a patch release changeset.
File summaries
File Summary
test/rich-text/plugins/link-editor.test.ts Adds accessibility coverage, but does not verify each label targets the intended input (moderate, 1 vote).
src/rich-text/plugins/link-editor.ts Fixes the label-to-input association.
.changeset/a11y-link-text-label.md Records the patch release.
Review details

Suppressed comments (1)

test/rich-text/plugins/link-editor.test.ts:71

  • This only verifies that each for value resolves to some <input>, so a regression that swaps the href and text IDs would still pass while the “Link text” label targets the URL field. Assert the first label resolves to .js-link-editor-href and the second to .js-link-editor-text (or compare each resolved node with those expected selectors).
            labels.forEach((label) => {
                expect(label.htmlFor).not.toBe("");
                expect(
                    container.querySelector(`#${label.htmlFor}`)
                ).toBeInstanceOf(HTMLInputElement);
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The accessibility fix, regression coverage, and patch changeset are complete with no unresolved blocking issues.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@alexwarren
alexwarren marked this pull request as ready for review September 16, 2026 15:44
@alexwarren
alexwarren requested a review from a team as a code owner September 16, 2026 15:44
@dancormier
dancormier merged commit 2638d64 into main Sep 17, 2026
10 checks passed
@dancormier
dancormier deleted the codex/a11y-196-link-text-label branch September 17, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants