【发布时间】:2022-02-06 04:21:13
【问题描述】:
我正在研究辅助功能,并在我的“tr”标签中添加了一个“tabindex = 0”。问题是如果我进入那个“tr”并在我的键盘上按“Enter”,“onclick”不起作用,但如果我用鼠标点击链接它仍然有效。我尝试在声明“onclick”的“tr”标签内添加一个锚标签,但这不起作用。这也在 python 代码中使用,其中“tr”是字符串的一部分。这是我的代码。
#print open shifts line
personal_table += """ <tr tabindex="0" class="open_shift_line odd clickable"
onclick="pop_over_window('/AcStaf/Home/my_self_schedule?id=%s&bdate=%s&edate=%s','Open Shifts')">
<td>%s%s Open Schedule</td> <td style="color:#EB0000">Closes %s at %s</td></tr>"""
%(id, per_startdate, per_enddate, sch_req_text, container.util.getDateDisplay(bdate=per_startdate, edate=per_enddate, date_format='%m-%d-%Y'),
container.util.getDateTimeStr(date=pub_period['publish_edate'], fmt='%m-%d'), container.util.format_acutime(acutime=pub_period['publish_etime']))
是否需要将 onclick 替换为“a href”?我有哪些选择?
【问题讨论】:
-
希望我给出的这个答案会有所帮助:stackoverflow.com/questions/64776155/…。我没有将问题标记为重复,因为问题略有不同,但那里解释的所有原则都适用,它为您提供了一些可通过键盘访问以及可通过鼠标使用的选项!
标签: javascript python html accessibility