如何让 -moz-user-focus:ignore 工作?

发布于 2024-09-18 03:33:04 字数 964 浏览 2 评论 0 原文

我的理解是,当使用 -moz-user-focus:ignore (see doc),则 Firefox 在按 Tab 键切换时应跳过该元素。但是,请尝试:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    </head>
    <body>
        <form action="/">
            <input type="text" value="First">
            <input type="text" value="Second" style="-moz-user-focus: ignore">
            <input type="text" value="Third">
        </form>
    </body>
</html>
  1. 第一次点击选项卡:您位于第一个文本字段。
  2. 第二次点击 Tab:尽管有 -moz-user-focus:ignore,但您仍位于第二个文本字段。我在这里错过了什么吗?

My understanding is that when using -moz-user-focus: ignore (see doc) on an element, Firefox should skip that element when tabbing. However, try:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    </head>
    <body>
        <form action="/">
            <input type="text" value="First">
            <input type="text" value="Second" style="-moz-user-focus: ignore">
            <input type="text" value="Third">
        </form>
    </body>
</html>
  1. Hit tab a first time: you're on the first text field.
  2. Hit tab a second time: you're on the second text field, despite the -moz-user-focus: ignore. Am I missing something here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

机场等船 2024-09-25 03:33:04

Mozilla bug 库中似乎有一个涵盖此问题的 bug。在修复此错误之前,我们可以使用 tabindex="-1" 而不是 CSS 作为解决方法。

It seems there is a bug covering this in the Mozilla bug base. Until this bug is fixed, we can use tabindex="-1" instead of CSS as a workaround.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文