如何为Shiny应用程序实现ARIA标签以满足WCAG的要求



我正在Shiny中编写一个应用程序,旨在通过使用ARIA标签(可访问的富互联网应用程序(来满足WCAG-2.0+(Web内容可访问性指南(标准。为此,我尝试使用嵌入在内置的闪亮小部件/函数中的html标记,但收效甚微。Shiny似乎无法识别ARIA标签,也无法通过更改属性来更改它。

例如,如何将咏叹调标签附加到以下内容?

a( href = "http://www.thislogo.com")
img(src = "logo.png",
title = "The logo",
height = "60px",
alt = "This is a picture of the logo, clicking on it links to thislogo.com",
HTML("aria-label = "logo")
)

我试过的第二个例子:

a(href = "http://www.thislogo.com",
img(src = "logo.png",
title = "The logo",
height = "60px",
alt = "This is a picture of the logo, clicking on it links to thislogo.com",
aria-label = "logo"
)
)

第三个对我不起作用的例子:

a(href = "http://www.thislogo.com",
img(src = "logo.png",
title = "The logo",
height = "60px",
alt = "This is a picture of the logo, clicking on it links to thislogo.com",
tags$html(aria-label = "logo")
)
)

我想知道是否有合适的方法来实现这一点,目前是否支持Shiny?我试着到处搜索,但这个话题似乎很少被讨论或仍在开发中。

我发现的最接近的例子是关于检查可访问性(链接(或更改语言属性(链接(的讨论,但没有太多关于实际实现ARIA标签的讨论。

感谢您的真知灼见。

当您要添加的属性由几个单词组成(如"aria"one_answers"label"(时,您需要用反勾号将其包裹起来,如下所示:

img(src = "logo.png",
title = "The logo",
height = "60px",
alt = "This is a picture of the logo",
`aria-label` = "logo")
<img src="logo.png" title="The logo" height="60px" alt="This is a picture of the logo" aria-label="logo"/>

最新更新