How do I add accessibility for AJAX Control Toolkit

Brian Tan 40 Reputation points
2024-03-05T23:23:13.37+00:00

I need to add accessibility to some of the web form controls. I am using axe devtools in order to test for accessibility. It comes up with this error and how to resolve the issue for a combobox User's image

This is the current code I have and I'm not sure how to make it accessible. I have this doc to show how to make ajaxToolkit:ComboBox accessible but AJAX toolkit itself doesn't hold some of the properties listed here such as arial-label.

<ajaxToolkit:ComboBox Title="Sponsor" ID="ComboBox" runat="server" AutoPostBack="False" DropDownStyle="DropDownList" ClientIDMode="Static" AutoCompleteMode="suggest" CaseSensitive="False">
   <asp:ListItem Selected="true" Text="" Value="0"></asp:ListItem>
</ajaxToolkit:ComboBox>

Here is my current code so far.

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,453 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 29,246 Reputation points Microsoft Vendor
    2024-03-06T06:38:32.8766667+00:00

    Hi @Brian Tan,

    You can add some attributes through the parent element (<div>,<span>).

    Below is my test for your reference.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm23.aspx.cs" Inherits="WebFormsDemo.WebForm23" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" lang="aa">
    <head runat="server">
        <title>Test</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>
                <div aria-label="search" role="combobox" aria-expanded="true" aria-controls="ComboBox">
                    <span aria-hidden="true">
                        <ajaxToolkit:ComboBox Title="Sponsor" ID="ComboBox" runat="server" AutoPostBack="False" DropDownStyle="DropDownList" ClientIDMode="Static" AutoCompleteMode="suggest" CaseSensitive="False" TabIndex="-1">
                            <asp:ListItem Selected="true" Text="" Value="0"></asp:ListItem>
                        </ajaxToolkit:ComboBox>
                    </span>
                </div>
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="Submit" />
            </div>
        </form>
    </body>
    </html>
    

    User's image

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.