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

查看:24
本文介绍了使用 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.

我将此输入框用作一个简单的机器人蜜罐并将其定位在页面之外,因此在使用 Tab 键时,在用户 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" 以便它在 Tab 键顺序中被忽略.0 告诉浏览器自己确定 Tab 键顺序,-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天全站免登陆