Skip to content

Commit 8a7dc0a

Browse files
github-actions[bot]KB Bot
and
KB Bot
authored
Added new kb article radcombobox-checkboxes-aria-support (#614)
Co-authored-by: KB Bot <[email protected]>
1 parent 37c9129 commit 8a7dc0a

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Fixing Missing ARIA Attributes in RadComboBox with CheckBoxes
3+
description: Learn how to address the missing aria-checked attributes and correct the invalid use of aria-selected in RadComboBox items with checkboxes and ARIA support enabled.
4+
type: troubleshooting
5+
page_title: How to Correct ARIA Attribute Errors in RadComboBox with CheckBoxes for Accessibility Compliance
6+
slug: radcombobox-checkboxes-aria-support
7+
tags: radcombobox, asp.net ajax, aria, checkboxes, accessibility, wcag
8+
res_type: kb
9+
ticketid: 1667614
10+
---
11+
12+
## Environment
13+
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product</td>
18+
<td>RadComboBox for ASP.NET AJAX</td>
19+
</tr>
20+
<tr>
21+
<td>Version</td>
22+
<td>2024.3.805</td>
23+
</tr>
24+
</table>
25+
26+
## Description
27+
28+
When using the [RadComboBox](https://docs.telerik.com/devtools/aspnet-ajax/controls/combobox/overview) with `EnableAriaSupport` set to `true` and `CheckBoxes` enabled, ARC toolkit reports errors related to missing `aria-checked` attributes and an invalid use of `aria-selected` in elements with the role of checkbox. This issue occurs when the dropdown is extended.
29+
30+
## Cause
31+
32+
The cause of the issue is that the RadComboBox items with checkboxes enabled and ARIA support do not automatically manage the `aria-checked` attribute, which is required for checkboxes to be compliant with WCAG 2.2 Success Criterion 4.1.2. Additionally, the `aria-selected` attribute is used incorrectly in this context.
33+
34+
## Solution
35+
36+
To resolve the missing `aria-checked` attributes and correct the invalid use of `aria-selected`, add a JavaScript function that sets the `aria-checked` attribute for each checkbox item in the RadComboBox when the dropdown is opened. This function also ensures that the `aria-selected` attribute is handled correctly.
37+
38+
The following example demonstrates how to implement this solution:
39+
40+
```aspx
41+
<telerik:RadComboBox ID="RadComboBox1" runat="server" RenderMode="Lightweight" EnableAriaSupport="true" CheckBoxes="true" OnClientDropDownOpened="onDropDownOpened">
42+
<Items>
43+
<telerik:RadComboBoxItem Text="Item 1" />
44+
<telerik:RadComboBoxItem Text="Item 2" />
45+
<telerik:RadComboBoxItem Text="Item 3" />
46+
<telerik:RadComboBoxItem Text="Item 4" />
47+
</Items>
48+
</telerik:RadComboBox>
49+
50+
<script>
51+
function onDropDownOpened(sender, args) {
52+
var $ = $telerik.$;
53+
// Select all li elements with class rcbItem and role checkbox and update aria-checked attribute
54+
$('.rcbItem[role="checkbox"]').each(function () {
55+
if ($(this).find('.rcbCheckBox').is(':checked')) {
56+
$(this).attr('aria-checked', 'true');
57+
} else {
58+
$(this).attr('aria-checked', 'false');
59+
}
60+
});
61+
}
62+
</script>
63+
```
64+
65+
This script selects all list items (`li`) with the class `rcbItem` and the role `checkbox`, and updates the `aria-checked` attribute based on whether the checkbox within the item is checked or not. This approach ensures that the RadComboBox with checkboxes complies with accessibility standards.
66+
67+
## See Also
68+
69+
- [RadComboBox Overview](https://docs.telerik.com/devtools/aspnet-ajax/controls/combobox/overview)
70+
- [WCAG 2.2 Success Criterion 4.1.2 Name, Role, Value](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html)

0 commit comments

Comments
 (0)