WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Aria Live announcements and .Net Pages

for

From: Greg Gamble
Date: Oct 18, 2017 9:49AM


I'm thinking it's the Async postback ... The alert is working, but before it can announce the page is somehow interrupting it, possibly on the DOM being updated? With the div containing the role='alert' at the top it's not being interrupted? Maybe a dwell in the Page_Init, but that would slow all pages down ...

Setting this code to top of content region is working :

<div class="text-center" role="alert">
<asp:Literal ID="litMsg" runat="server"></asp:Literal>
</div>

I send my text to it and they are announced. This is the method I use ... It's in a Utility class that I call as needed:
The method call:
ConstClass.SetMessage(this.Page, "OK", "Account Updated Successfully");

Method in ConstClass class:
public static void SetMessage(Page pg, String type, String sMessage)
{
Literal feedback = (Literal)Utility.FindControlRecursive(pg, "litMsg");
feedback.Visible = false;
feedback.Text = String.Empty;
switch (type.ToUpper())
{
case "ERROR":
{
feedback.Visible = true;
feedback.Text = @"<p class='bg-danger' style='padding: 4px;' ><span /><span class='glyphicon glyphicon-warning-sign' aria-hidden='true'></span> " + sMessage + @"</p>";
break;
}
case "OK":
{
feedback.Visible = true;
feedback.Text = @"<p class='bg-success' style='padding: 4px;' ><span class='glyphicon glyphicon-ok' aria-hidden='true'></span> " + sMessage + @"</p>";
break;
}
case "EDIT":
{
feedback.Visible = true;
feedback.Text = @"<p class='bg-warning' style='padding: 4px;' ><span class='glyphicon glyphicon-ok' aria-hidden='true'></span> " + sMessage + @"</p>";
break;
}
case "CLEAR":
{
feedback.Visible = false;
break;
}
default:
{
feedback.Visible = true;
feedback.Text = @"<p class='bg-primary' style='padding: 4px;'> " + sMessage + @"</p>";
break;
}
}
}

FYI ... The CSS classes shown are in Bootstrap.

Greg