ShareThis 可访问性问题 - 如何添加键盘支持 [英] ShareThis Accessability Issue - How to Add Keyboard Support

查看:25
本文介绍了ShareThis 可访问性问题 - 如何添加键盘支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个现有项目,并修复了一些辅助功能支持.我的可访问性列表中的一项是指 ShareThis 社交按钮.出于某种原因,它不支持从键盘导航.我已将 "tabindex=0" 属性添加到所有社交图标 元素.所以现在我可以导航了,但是我无法通过单击Enter"来激活它.我真的需要为所有这些按钮编写自己的 JS 函数吗?也许有人之前为 ShareThis 编写了可访问性解决方案?

I'm working on an existing project and make some fixes for accessibility support. One of the items from my accessibility list refers to the ShareThis social buttons. For some reason it doesn't support navigation from keyboard. I've added "tabindex=0" attribute to all social icons <span> elements. So now I can navigate, but I can't activate it by clicking "Enter". Do I really need to write my own JS functions for all this buttons? Maybe there is accessability solution that somebody wrote before for ShareThis?

推荐答案

您添加的 tabindex 属性将使跨度可通过键盘聚焦,但不提供对 Enter 事件的任何支持.您需要在 JavaScript 中为 Enter 添加侦听器.或者,您可以将跨度切换为链接或按钮 - 这些具有本机键盘支持,因此不需要额外的 JavaScript.

The tabindex attribute you added will make the spans focusable by keyboard, but doesn't provide any support for Enter events. You will need to add listeners for Enter in JavaScript. Alternatively you could switch the spans to links or buttons - these have native keyboard support so won't need the additional JavaScript.

这篇关于ShareThis 可访问性问题 - 如何添加键盘支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆