fix(core/caniuse): add role=img to browser support cells for valid HTML#5176
fix(core/caniuse): add role=img to browser support cells for valid HTML#5176marcoscaceres merged 10 commits intomainfrom
role=img to browser support cells for valid HTML#5176Conversation
There was a problem hiding this comment.
Pull request overview
Fixes HTML validity for the “Can I Use” browser support cells by ensuring elements with aria-label have an appropriate ARIA role, aligning generated output with Nu validator requirements (per #5091).
Changes:
- Add
role="img"to caniuse browser support cell containers that usearia-label. - Make the nested browser logo
<img>decorative by settingalt=""to avoid double announcements.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot, it's unclear what the right markup is for this from the issue... what does the validator actually say? |
The Nu validator error (from the issue) is:
An alternative would be |
|
@copilot, do what you think is best for accessibility here. And also check what's going on with CI... looks like lint issues. |
|
@copilot, can you fix the lint issues from CI? |
Fixed in 41d74ea. The lint failure was a prettier formatting issue — the ternary for |
The div has aria-label with the full description, so children are presentational. Set inner img alt to empty to avoid double-announcement.
Agent-Logs-Url: https://github.com/speced/respec/sessions/391940a3-1f50-400e-849b-39f06e39e7bb Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
Agent-Logs-Url: https://github.com/speced/respec/sessions/6ae7a1ff-7486-4388-b079-084233604857 Co-authored-by: marcoscaceres <870154+marcoscaceres@users.noreply.github.com>
41d74ea to
fb850cf
Compare
The nullish coalescing operator treats "" as non-nullish, so an empty-string version would display as blank instead of the em dash fallback. The ternary correctly maps falsy values (including "") to the fallback.
Avoid injecting a duplicate heading when #bp-summary already has one, and use prepend() so the generated heading always appears at the top. Closes #5176
There was a problem hiding this comment.
Pull request overview
Fixes invalid Can I Use markup flagged by the Nu HTML validator by ensuring elements with aria-label have an appropriate ARIA role, while keeping screen reader output clean and consistent with the visible UI.
Changes:
- Add
role="img"to Can I Use browser support cells that usearia-label. - Make the inner browser logo image decorative (
alt="") to avoid double announcements. - Ensure
aria-labelincludes a “(version unknown)” suffix when the displayed version is “—”, and add assertions covering this behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/core/caniuse.js | Adds role="img" and updates accessible naming (including unknown-version case) while making the inner logo image decorative. |
| tests/spec/core/caniuse-spec.js | Updates/extends tests to match the new accessibility/validity behavior (alt="", role="img", and unknown-version aria-label). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
role=img to browser support cells for valid HTML
The div elements with aria-label lacked a role attribute, violating HTML spec per the Nu validator. Added role=img since the aria-label fully describes the visual content. Set inner img alt to empty to avoid double-announcement.
Closes #5091