Tab 键在 Chrome 扩展中的弹出窗口中不起作用 [英] Tab key not working in popup in chrome extension

查看:41
本文介绍了Tab 键在 Chrome 扩展中的弹出窗口中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 chrome 扩展,其中有一个弹出窗口,其中包含以下 HTML 标记:

I have created a chrome extension that has a popup with the following HTML markup in it:

<html>
<head>
<style>
body {
font-family: 'Open Sans',arial,sans-serif;
background-color: #E5E5E5;
font-size: 13px;
text-shadow: 0px 1px rgba(255, 255, 255, 0.5);
}
</style>
</head>
<script type="text/javascript">function sendRequest(s,r){
chrome.tabs.getSelected(null, function(tab) {
  chrome.tabs.sendRequest(tab.id, {search:s , replace:r}, function(response) {
    console.log(response.farewell);
  });
});
};
</script>
<body>

<label for="search">Search for</label><input name="search" id="search"></input>
<label for="replace">Replace with</label><input name="replace" id="replace"></input>
<button onclick="var s=document.getElementById('search').value;var r=document.getElementById('replace').value;sendRequest(s,r);">Go</button>
</body>
</html>

当我打开弹出窗口时,选择第一个输入字段,然后按 Tab 键,输入字段失去焦点,但第二个没有获得焦点.

When I open the popup, select the first input field and then press the tab key, the input field loses focus but the second one does not gain focus.

如果我再次选择第一个并再次按 Tab,则第二个字段获得焦点.再次按下使按钮获得焦点,第三次按下使第一个字段再次获得焦点.

If I then select the first one again and press tab once more, the second field gains focus. Pressing again makes the button gain focus and pressing a third time makes the first field gain focus once more.

有谁知道为什么第一次按 Tab 键不起作用?

Does anyone know why the first tab key press would not work?

推荐答案

在此处查看 Chrome 错误报告:http://code.google.com/p/chromium/issues/detail?id=122352

See Chrome bug report here: http://code.google.com/p/chromium/issues/detail?id=122352

编辑:目前在 Canary 版本 26.0.1408.1(官方版本 181614)中实施了本次编辑.

EDIT: Fix is currently implemented in Canary build 26.0.1408.1 (Official Build 181614) at the time of this edit.

这篇关于Tab 键在 Chrome 扩展中的弹出窗口中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆