为什么将制表符索引添加到 tag cause it to affect the :focus behavior in chrome?

问题描述 投票:0回答:1

考虑以下内容:

<a tabindex="0" href="">With TabIndex</a>
<a href="">Without TabIndex</a>

https://jsfiddle.net/uLg7jyo9/1/

第一个链接上的鼠标向下移动并向上移动鼠标,您会发现蓝色边框仍然存在。

在第二个链接上执行相同的操作,您会发现不是。

我希望标签索引影响标签事件而不是单击事件。我该如何解决?

注意:Firefox似乎对它们相同。

html css google-chrome hyperlink tabindex
1个回答
-1
投票

tabindex =“ 0”表示该元素在顺序键盘导航中应该是可聚焦的,但是其顺序由文档的源顺序定义。

https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/tabindex

© www.soinside.com 2019 - 2024. All rights reserved.