Tab键在Chrome扩展中的弹出窗口中不起作用

编程入门 行业动态 更新时间:2024-10-28 18:30:27
本文介绍了Tab键在Chrome扩展中的弹出窗口中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

< 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>搜索< / label>< input name =searchid =search>< / input> < label for =replace>替换为< / label>< input name =replaceid =replace>< / input> < button onclick =var s = document.getElementById('search').value; var r = document.getElementById('replace').value; sendRequest(s,r);> Go< /按钮> < / body> < / html>

当我打开弹出窗口时,选择第一个输入字段,然后按Tab键,输入字段如果我再次选择第一个并再次按下标签,则第二个领域将获得焦点。再次按下按钮增益焦点,第三次按第一次让焦点再次聚焦。

有谁知道为什么第一个按键不起作用? / p>

解决方案

请参阅Chrome bug报告: code.google/p/chromium/issues/detail?id=122352

编辑:修正目前在编辑时在加纳利版本26.0.1408.1(官方版本181614)中实施。

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>

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.

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.

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

解决方案

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

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

更多推荐

Tab键在Chrome扩展中的弹出窗口中不起作用

本文发布于:2023-08-06 04:56:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1310197.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出   不起作用   窗口中   Tab   Chrome

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!