在 webkit 中使用键盘加速器的 select/optgroup 中存在错误?

发布于 2024-12-26 14:53:19 字数 329 浏览 4 评论 0原文

请参阅 http://jsfiddle.net/3EksU/2/

在示例中使用 Safari 和 Chrome,如果您选择(不打开下拉菜单),然后我按键盘上的字母键,选择框中的值(如果按预期在以该字母开头的值之间旋转)。

但是如果选择下拉菜单打开,按第一个下拉菜单上的任意键总是会带我到苏黎世,而在第二个下拉菜单上按任意键会带我到“Zoo”,

在 Firefox 中没有问题。它按预期工作,

这似乎是一个错误。或者我在 HTML 中做错了什么?

See http://jsfiddle.net/3EksU/2/

With Safari and Chrome in the example, if you select (without opening the drop down) and I press a letter key on the keyboard, the value in the select box if rotating among the value that begin with that letter AS EXPECTED.

However if the select drop down is open, pressing any key on the first drop down bring me always to Zurich and on the second it brings me on "Zoo"

No problems in Firefox. It works as expected

It seems to be a bug. Or am I doing something wrong in the HTML?

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

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

发布评论

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

评论(2

抚笙 2025-01-02 14:53:19

在 jQuery 中解决:

if($.browser.webkit)
$(...).find('optgroup').each(function() {
  var optgrp = $(this);
  optgrp.parent().append('<option disabled="disabled">' + optgrp.attr('label') + '</option>' + optgrp.html()); 
  optgrp.remove();
});

Work around in jQuery:

if($.browser.webkit)
$(...).find('optgroup').each(function() {
  var optgrp = $(this);
  optgrp.parent().append('<option disabled="disabled">' + optgrp.attr('label') + '</option>' + optgrp.html()); 
  optgrp.remove();
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文