The PR restyles a close control and also changes aria-label="Close" to aria-label="Close dialog", or it drops aria-labelledby and points the dialog at a new visible heading that is not wired up. Visual tests stay green. Screen-reader copy, locators, and translated strings do not.
I’ve started treating an unrelated ARIA rename in a visual PR as a regression. If the accessible name was not the ticket, leave it alone. If the name must change, that is an explicit a11y change, with a reason.
Why the labels get rewritten
The model wants to be helpful. It “clarifies” a short label, or it regenerates a whole JSX block and the attributes come back slightly different. aria-labelledby is easy to drop when the heading markup moves. Tests that query by role and name then flake, and translators lose a stable string.
This is the same class of damage as rewriting test IDs or analytics attributes “while we’re here.”
A simple ARIA policy
- Do not edit
aria-label,aria-labelledby,aria-describedby, oraria-livein a visual-only PR - If the visible text that already names the control changed, update the accessible name to match
- Do not invent an
aria-labelthat duplicates visible text - When you move a heading, keep the
idhook the dialog or section already uses
Paste the current attributes in the prompt and say they are frozen unless the name is in scope.
What to put in the prompt
Do not change existing aria-label, aria-labelledby, aria-describedby, or aria-live attributes unless this PR is supposed to change the accessible name. If you move a heading or label, keep the existing id so labelledby still points at it. Do not add an aria-label that only repeats visible text. If a name is wrong, call it out; do not silently rewrite it in a restyle. In review, diff only the ARIA and id attributes. If they changed and the ticket was visual, send it back.
Reject / send back
Reject
- A restyle that rewords
aria-labelor dropsaria-labelledby - A new
aria-labelthat duplicates a visible name - A heading
idchange that breaks an existing labelledby hook - “Improved” live-region politeness that was not in scope
Accept
- A visual change that leaves the accessible name and hooks intact
- A name change that matches new visible text, called out in the PR
- A dedicated a11y fix with before/after names and a reason