鼠标悬停时文本字段输入焦点

发布于 2024-09-19 20:49:47 字数 209 浏览 6 评论 0原文

我们有以下代码片段来关注表单中的特定文本字段 onmouseover="this.focus();"

我们在整个用户界面中有很多文本输入字段,它们需要某种输入来自用户。假设目标受众不太懂计算机(例如第一次使用计算机的儿童和成人),在鼠标悬停时将焦点集中到文本字段是否是一个好习惯?

这是一个好习惯吗?否则用户将不得不在键入之前单击文本字段中的内容

We have the following snippet to get focus on a particular text field in a form onmouseover="this.focus();"

We have lots of text input fields throughout the user interface which expect some kind of input from the user. Is it a good practice to provide focus to the text fields onmouseover, assuming the target audience is not that computer savvy (e.g. children and adults who are first time computer users)

Is this a good practice, else users will have to click before they type something into the text field

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

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

发布评论

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

评论(2

微凉徒眸意 2024-09-26 20:49:47

嗯,这实际上取决于您想要为用户提供的可用性。
除此之外,这还取决于您拥有的用户类型。

我不认为关注悬停是一个特别好的主意,原因如下:

  • 当普通用户第一次看到表单时,他们会首先单击他们想要编辑的字段(这来自直觉,因为这是他们通常的方式以表格形式呈现。)。之后,他们会将光标移开,以便他们可以看到自己正在输入的内容。在您的场景中,这可能会导致用户将焦点转移到另一个元素。
  • 实际上,此列表中的第一项包含几个原因(这不是自然行为,可能会导致不必要的焦点丢失)

更高级的表单流程,可以说......通常从表单的第一个字段开始,然后使用 Tab 键通过键盘进行导航。

我建议您努力通过使用 tab 键导航来使表单流程正常(HTML 有一个很好的方法来做到这一点,除非您的代码到处都是并且您有 css 将它们放在特定位置)。

我将保留表单原样,没有鼠标悬停焦点。关注鼠标悬停不是标准行为可能是有充分理由的;)

Well, it really depends on the usability you want to offer your users.
Aside from that, it will depend on what type of users you have.

I don't presume the focus on a hover is a particular good idea for the following reasons:

  • When the average user first sees a form, they will click the field they want to edit first (This comes by intuition because that's the way they usually are presented with forms.). After that, they will move the cursor away, so they can see what they are typing. In your scenario, this will cause the users to possibly change focus to another element.
  • Actually, the first item in this list contained a few reasons (It's not natural behavior and it might cause unwanted loss of focus)

The more advanced form-processes, so to say... Will usually start with the first field of a form, and then navigate it by keyboard with use of the tab-key.

I recommend you put your effort into making the flow of the form alright by navigating it with the tab key (HTML has a pretty good way of doing this, unless your code is all over the place and you have css putting them on their specific locations).

I would just leave the form as is, without mouse-over focusses. There's probably a good reason why focus on mouseover is not standard behavior ;)

べ繥欢鉨o。 2024-09-26 20:49:47

当计算机应用程序将鼠标悬停在某个区域上时,通常不会聚焦该区域。如果您的应用程序以不同的方式执行此操作,儿童和其他初学者会感到困惑。点击=焦点是一般性的事情,不要试图偏离这一点。

更好的解决方案是添加类似 title="如果您想输入内容,请点击鼠标按钮"

Computer applications does not usually focus a field when hovering over it. Children and other beginners would get confused if your application would do it in a different way. Click = focus is something general, do not try to diverge from that.

A better solution would add something like title="Click with your mousebutton if you want to enter something".

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