当网页完成加载时,焦点是否应该集中到控件上?

发布于 2024-07-15 19:13:43 字数 559 浏览 8 评论 0原文

以下是我的意思的一些示例:

google.com - 焦点设置在“搜索”框上

gmail.google.com - 焦点设置在“用户名”字段上(实际上,大多数网络电子邮件客户端都是这样做的)。

stackoverflow,提出问题 - 焦点设置在“标题”框上。

有时,这是一个方便的功能 - 例如,在 Google 上。 然而,从可用性的角度来看,登录页面上的这个功能真的被认为是一个好功能吗?

就我个人而言,我经常输入我的用户名,开始输入我的密码,然后页面完成加载并将焦点放回用户名字段。 不幸的是,由于我有复杂的密码,迫使我在打字时看着键盘,所以我无法注意到焦点何时转移。 我经常在未屏蔽的用户名字段中输入密码,以供站在我身后的任何人看到。

另一种情况虽然不太危险,但仍然很烦人,那就是当我在地址栏中输入网址时,我的主页仍在加载。 然而,一旦完成,如果我没有完成输入网址,焦点就会从我身上被窃取并转移到其他字段上。

是否应该对网站和/或浏览器进行编程,以便在用户已经与网站或浏览器交互时焦点不会改变? 像这样的问题会困扰普通(即非程序员)用户吗?

Here are some examples of what I mean:

google.com - focus is set on the "search" box

gmail.google.com - focus is set on the "user name" field (actually, most web email clients do this).

stackoverflow, ask a question - focus is set on the "title" box.

Sometimes, this is a convenient feature - e.g., on Google. From a usability standpoint, however, is it really considered a good feature to have on login pages?

Personally, I have often entered my user name, started to enter my password, then the page finished loading and had focus put back onto the user name field. Unfortunately, since I have complex passwords that force me to look at the keyboard while typing, I fail to notice when focus shifts. I often wind up typing my password in the unmasked user name field for anyone standing behind me to see.

Another situation, less dangerous but still annoying, is when I'm typing a url in my address bar while my homepage is still loading. As soon as it finishes, however, and if I'm not done entering the url, focus is stolen from me and put on some other field.

Should websites and/or browsers be programmed so that focus won't change if the user is already interacting with the site or the browser? Do problems like this bother ordinary (i.e., non-programmer) users?

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

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

发布评论

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

评论(6

£烟消云散 2024-07-22 19:13:43

这实际上是两个具有不同答案的独立问题:

问:是否应该将焦点放在用户最有可能使用的输入字段上?

答:如果“大多数用户”确实达到 90% 或更多,那么肯定是的。

问:网页加载完成后是否会发生这种情况?

答:不。“onLoad”事件是一个非常愚蠢的地方。 输入字段应该在出现时立即获得焦点 - 当页面完成加载时它通常完全无关。 只需在输入元素本身之后放置一个

These are really two separate questions with different answers:

Q: Should focus be given to the input field the user is most likely to use?

A: Most definitely yes, if "most users" really is 90% or more.

Q: Should this happen when the webpage finishes loading?

A: No. The "onLoad" event is a pretty stupid place to put this. The input field should get the focus as soon as it appears - it's usually completely irrelevant when the page finishes loading. Just put a <script> tag that sets the focus right after the input element itself.

长梦不多时 2024-07-22 19:13:43

我个人讨厌网站成为焦点。 主要原因是,在我的笔记本电脑上,如果我使用触控板并按退格键,它将自动导航回上一页。 如果焦点已放在文本框上,它会将退格键视为我正在尝试删除字符。

我个人的偏好(这与最佳实践无关)是,没有任何内容应该具有初始焦点,但第一个选项卡会将其带到您想要初始焦点的元素。

I personally hate it when websites assume the focus. The main reason is that on my laptop, if I'm using the track pad and hit the backspace key it will automatically navigate back to the previous page. If focus has been placed on a textbox it will treat the backspace as tho I'm trying to delete a character.

My personal preference (and this has very little to do with best practice) is that it nothing should have initial focus, but the first tab will take it to the element that you want to have initial focus.

最近可好 2024-07-22 19:13:43

Gmail 中也发生了同样的情况,我觉得这有点烦人,特别是因为它应该很容易规避:
OnLoad 事件处理程序中,检查输入框(用户名或密码)是否已包含文本。 如果是这种情况,请不要改变焦点。

与所有简单的解决方案一样,如果出现一些奇怪的副作用使其不切实际,我不会感到惊讶,但无论如何我都会尝试一下。
哦,如果有效的话,为什么不向 Google 发送电子邮件呢? ;-)

话虽这么说,我认为这种行为是一个可用性故障,这不是一个错误,但有点烦人。 不要惹恼你的顾客。 修理它。

The same happened to me in Gmail, I find it slightly annoying, especially since it should be easy to circumvent:
In the OnLoad event handler, check if the input boxes (username or password) already contain text. If this is the case, do not change the focus.

As with all simple solutions, I would not be surprised if there were some strange side effects that render it unpractical, but I would give it a try anyway.
Oh, and if it works, why don't you send an email to Google? ;-)

That being said, I consider this behaviour a usability glitch, something that is not a bug, but slightly annoying. Don't annoy your customers. Fix it.

-小熊_ 2024-07-22 19:13:43

我认为只有我们程序员才有在页面加载之前打字的习惯;-)
我的大多数非程序员朋友都等到他们从加载区域看到“已完成”信号。

但上面的两个问题比每次在不关注特定控件的网站中输入我们想要的内容(用户名、密码)时必须移动鼠标指针/使用选项卡要少一些烦人的问题。

“是否应该对网站和/或浏览器进行编程,以便在用户已经与网站或浏览器交互时焦点不会改变?”

我认为浏览器应该比网站更能做到这一点。 因为这将是另一次返回服务器的旅程,并且对于低速连接可能会令人沮丧。

总的来说,我认为这只是我们可以忍受的另一个小问题/烦恼。 正如我所说,只有我们程序员甚至在页面加载之前就跳转了类型。 我的大多数朋友不知道他们可以在页面加载之前输入:)

I think only we programmers have the habit of typing even before the page gets loaded ;-)
Most of the non-programmers friends I have wait till they see the "Completed" signal from the loading area.

But the 2 issues above are les annoying than having to move our mouse pointer/use tab everytime to type in what we want (username, password) in sites which do not have focus on a particular control.

"Should websites and/or browsers be programmed so that focus won't change if the user is already interacting with the site or the browser? "

I think browsers should be enabled to do this than the websites. Becauase it will be another trip back to server and can be frustrating for connections with low speed.

Overall I think this is just another minor issue/annoyance which we can live with. As I said only we programmers jump in type even before the page loads. Most of my friends dont know that they can type before the page gets loaded :)

别在捏我脸啦 2024-07-22 19:13:43

在某些网站上,您实际上有一个普通用户使用键盘的用例(普通用户 - 因为像我这样的一些人也使用键盘进行导航)。 像 Google 搜索这样的网站实际上希望您只需输入要查找的内容并按 enter

具有多个输入区域和多个退出路径的站点有时也会将初始焦点放在某个地方,然后就会变得烦人。 如果他们的输入区域有一些奇怪的 Tab 键顺序,情况会变得更糟 - 所以他们实际上强迫你使用鼠标。

我个人不认为当网站完成加载时焦点的变化是一个问题,而不是对于一般用户而言。 但是,正如我提到的,如果它真的有用,那就取决于您的特定应用程序的用例是什么。 这可能是向某些人展示处于测试阶段的应用程序并执行可用性测试的问题。

There are sites where you acutally have one usecase a normal user uses keyboard for (normal user - as some, like me, use keyboard to navigate also). Sites like Google search actually expect you to just enter what you're looking for and hit enter.

Sites with multiple input areas and multiple exit paths though sometimes put initial focus somewhere too, and then it gets annoying. It gets even worse if they haev some odd tabbing order of their input areas - so they actually force you to use mouse.

I personally don't see the changing of focus when site finishes it's loading as an issue, not for a general user. But, as I mentioned, if it's really useful, it's a matter of what's the usecase in your particular application. And this might be a matter of showing the application in it's beta-stage to some people and performing usability tests.

浮云落日 2024-07-22 19:13:43

是的,焦点应默认位于用户最有可能开始输入的位置。 不这样做就是教科书式的糟糕的 UI 设计。

当焦点默认干扰您已经在做的事情时,这不是焦点默认的固有问题,而是由于实施不当而导致的失败。 除其他原因外,这就是为什么我编写了一个通用“智能”自动对焦脚本,它可以执行诸如离开您之类的操作如果你已经开始打字了,那就独自一人吧。

(是的,我知道它很毛茸茸。大部分毛茸茸的东西都是在处理跨浏览器问题——实际上,这是 Firefox 的一次失败。)

Yes, focus should default to the most likely place for a user to start typing. Not doing so is textbook bad UI design.

When focus defaulting interferes with something you're already doing, this isn't an inherent problem of focus defaulting, it's a failure of an inadequate implementation. This, among other reasons, is why I put together a generic 'smart' autofocus script that does things like leaving you the hell alone if you've already started typing.

(Yes, I know it's hairy. Most of the hairiness is dealing with cross-browser issues -- a failing of Firefox, actually, for once.)

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