I have a "next" button which gray out after click next so the screen reader read "NEXT IS DISABLED". How can I disable "NEXT IS DISABLED" from screen reader? I tried aria-hidden=true or aria-disabled=true but it did not work. Please advise. Thanks.
--
<asp:Label ID="lblNext" runat="server" Text=" " Visible="False" />
<GSI:GSIButton ClickOnce="true" ID="btnNext" runat="server" aria-disabled="true" CssClass="formbutt" OnClick="GotoNextPage" Text="<%$ Resources: Resource, _Next %>" aria-label="<%$ Resources:Resource,lbtnNext %>" />
Protected Sub GotoNextPage(ByVal sender As Object, ByVal e As System.EventArgs)
_GoNextEventHandler.Invoke(sender, e)
End Sub
Public Property ClickOnce As Boolean
Get
Return _ClickOnce
End Get
Set(value As Boolean)
_ClickOnce = value
End Set
End Property
Private Sub EmitClickOnceJS()
If ClickOnce Then
Dim js As New StringBuilder
'function to disable button if it was then element which caused postback
js.AppendLine("<script type='text/javascript'>")
js.AppendFormat("function DisableButton_{0}()", Me.ClientID)
js.AppendLine("{")
js.AppendFormat(" if(document.activeElement.id=='{0}') document.getElementById('{0}').disabled=true;", Me.ClientID)
js.AppendLine()
js.AppendLine("}")
'ensure this function is caused when posting back using before unload
js.AppendFormat("$(window).on('beforeunload',DisableButton_{0})", Me.ClientID)
js.AppendLine()
'async begin request disable if this button was cause of postback
js.AppendLine("var postbackElement;")
js.AppendLine("$(document).ready(function(){")
js.AppendLine(" try {")
js.AppendLine(" Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function(sender,args)")
js.AppendLine(" {")
js.AppendLine(" postbackElement = args.get_postBackElement();")
js.AppendFormat(" if(postbackElement.id=='{0}') document.getElementById('{0}').disabled=true;", Me.ClientID)
js.AppendLine(" });")
js.AppendLine(" }catch(e){}")
js.AppendLine("});")
'async end request enable if this was the button which caused postback
js.AppendLine("$(document).ready(function(){")
js.AppendLine(" try {")
js.AppendLine(" Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender,args)")
js.AppendLine(" {")
js.AppendFormat(" if(postbackElement.id=='{0}') document.getElementById('{0}').disabled=false;", Me.ClientID)
js.AppendLine(" });")
js.AppendLine(" }catch(e){}")
js.AppendLine("});")
js.AppendLine("</script>")
'register the js
If Not Page.ClientScript.IsClientScriptBlockRegistered(String.Format("disable{0}", Me.ClientID)) Then
Page.ClientScript.RegisterClientScriptBlock(Page.GetType, String.Format("disable{0}", Me.ClientID), js.ToString())
End If
End If
End Sub