Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab key not working in popup in chrome extension

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?

like image 410
forgetso Avatar asked Jan 30 '12 21:01

forgetso


People also ask

Why tab is not working in Chrome?

Sometimes, Chrome tabs lock up or freeze. In such situations, use the Chrome task manager to force-close individual tabs. Go to the More menu (three vertically aligned dots), then select More Tools > Task Manager. Close and reopen Chrome.


1 Answers

See Chrome bug report here: http://code.google.com/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.

like image 192
trinth Avatar answered Oct 28 '22 16:10

trinth