使用Tab键浏览时可以忽略某些网站元素吗? [英] Can I ignore some website element when navigating using the tab key?

查看:140
本文介绍了使用Tab键浏览时可以忽略某些网站元素吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确实是一个问题。我的页面上有一个输入框,使用键盘Tab键导航时会忽略该输入框。

As question really. I have an input box on my page that I would like to ignore when navigating using the keyboard tab key.

我将这个输入框用作简单的bot honeytrap和将其放置在页面之外,因此在使用Tab键时,它看上去对用户来说似乎没有焦点,当他们选择该元素时。

I'm using this input box as a simple bot honeytrap and positioning it off the page, so at the moment when using the tab key, it looks to the user as though nothing has focus when they tab to this element.

推荐答案

您可以在此元素上设置 tabindex =-1 ,以便按制表顺序将其忽略。 0 告诉浏览器自己确定跳格顺序, -1 告诉浏览器忽略它。

You can set the tabindex="-1" on this element so it's ignored in the tab order. 0 tells the browser to figure out the tab order on it's own, -1 tells the browser to ignore it.

这篇关于使用Tab键浏览时可以忽略某些网站元素吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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