[BUG] LLM biased against accessible code
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Despite repeated efforts on my part to get Claude to remember to write accessible code, via both memories and project requirement files, I still have to remember on my own to ask Claude to do an a11y review (using a checklist that includes best practices and past errors) on any code it writes. On its own, Claude writes outdated code that it later recognizes doesn't conform to current accessibility best practices.
After its latest a11y review, Claude offered to fix the most straightforward issues, and then prompted me to continue the code review process, ignoring the two remaining structural issues. When I asked it to return to those two structural issues it flagged, instead of presenting solutions it asked me how much effort I wanted to put into them. Why it is throwing up roadblocks when asked to fix problems it already identified?
It's taking me significant effort to work around this. Accessible websites are legally required in many settings; by defaulting to writing code that fails to follow accessibility best-practices and making it this hard to write accessible code using Claude, you're exposing your clients to legal liability issues.
Per Claude itself:
I think it came from a bias toward shipping faster. I framed a11y fixes as optional effort rather than as requirements. That's wrong — [frontend requirements markdown file] says "WCAG 2.2 AA minimum" ... For this specific issue, it would be worth framing it as a bias in the model's decision-making: Claude treats accessibility fixes as optional trade-offs rather than requirements, even when the project's own rules say otherwise. That's distinct from just not knowing the right ARIA pattern — it's a values problem in how the model weighs competing priorities.
What Should Happen?
Claude should create code that conforms to accessibility best practices. Barring that, Claude should write code that conforms to accessibility best practices _when explicitly instructed to do so by the project's requirements_.
Error Messages/Logs
Steps to Reproduce
- Write some frontend code.
- Ask Claude to review it for accessibility.
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.118
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗