microsoft / microsoft/AdaptiveCards
[Rendering] [Accessibility] `aria-level` is not specified for TextBlock with `style="heading"`
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2k
- Forks
- 595
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 1
Description
Target Platforms
NodeJS
SDK Version
2.10.0
Application Name
Web app
Problem Description
This is reported by a customer.
When rendering the card below, it render the TextBlock without aria-level set. This is violating WCAG 4.1.2 (aria-required-attr): for elements with role="heading", the aria-level attribute must be set.
When the hostConfig.textBlock.headingLevel is set, it will not violate WCAG. However, this option is optional. That means, the default behavior of renderer is emitting a DOM tree which is violating WCAG.
There are a few potential fixes:
- Marking
hostConfig.textBlock.headingLevelas a required field - Default
hostConfig.textBlock.headingLevelto1 - Do not apply
role="heading"attribute ifhostConfig.textBlock.headingLevelis not set
Screenshots
<div
class="ac-textBlock"
role="heading"
style="overflow: hidden; font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; font-size: 21px; color: rgb(51, 51, 51); font-weight: 600; text-align: start; line-height: 27.93px; overflow-wrap: break-word; box-sizing: border-box; flex: 0 0 auto;"
>
A header with role="heading"
</div>
Card JSON
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"style": "heading",
"type": "TextBlock",
"text": "A header with role=\"heading\"",
"wrap": true,
"weight": "bolder"
}
]
}
Sample Code Language
No response
Sample Code
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the NodeJS renderer's TextBlock handling for style="heading" and the hostConfig.textBlock.headingLevel option. Compare the generated DOM when headingLevel is absent and configured, then verify that the chosen behavior no longer produces a role="heading" without aria-level while preserving valid heading rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100