更改编辑|详情|删除“操作”链接以为508个合规性阅读器提供替换文本

时间:2019-07-18 20:33:04

标签: c# asp.net-mvc section508

MVC @Html.ActionLink编辑,如果您运行JAWS之类的合规性程序,只需说“编辑”视觉效果就可以了,但是如果您是作为视觉障碍者进行查找的。成千上万的“编辑”并不能帮助您了解自己所处的位置。我需要法规遵从程序说“编辑CustomerX”,但将可视房地产降至“编辑”。删除和详细信息也是如此。

我尝试使用隐藏标签,但是没有用。我本以为标题可以做到这一点,但没有看到任何结果,并且读了一篇标题属性不好的文章。还在为此寻找更多论点。

搜索508的错误正常设置:

@Html.ActionLink("Edit", "Edit", new { id = item.CustomerID }) 

不使用隐藏标签:

@Html.ActionLink("Edit", "Edit", new { id = item.CustomerID })
<label class="hidden">&nbsp @item.CustomerName &nbsp</label>

试图找到优点和缺点: @Html.ActionLink("Edit", "Edit", new { id = item.ApplicationID }, new{ title="Edit " + item.CustomorName })不确定这样做的效果如何。

1 个答案:

答案 0 :(得分:3)

我发现,如果您在实际的<a>标记内具有唯一标识符并使​​用CSS隐藏它,则在JAWS和其他屏幕阅读器中更容易理解。不幸的是,我们需要使用@Url.Action而不是@Html.ActionLink来实现这一目标。

<a href="@Url.Action("Edit", "ControllerName")">Edit <span class="visual-hidden"> for @item.CustomorName</span></a>

和CSS:

.visual-hidden {
    position: absolute !important;
    height: 1px; width: 1px; 
    overflow: hidden;
    clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
    clip: rect(1px, 1px, 1px, 1px);
}

另一种(更简便的)解决方案是使用aria-label HTML属性。这是有关aria-label属性的更多信息的链接。这将使屏幕阅读器知道编辑按钮的作用,并且您可以使用@Html.ActionLink方法:

@Html.ActionLink("Edit", "Edit", new { id = item.ApplicationID }, new{ aria_label="Edit for " + item.CustomorName })