9

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?

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
forgetso
  • 2,194
  • 14
  • 33
  • Unfortunatley I cant answer your question (thats really odd I wonder whats going on?) but heres a couple of pointers to do with tabbing. If you care about the tabbing stuff you should use tabindex, you should make something focus on page load and you should put in something invisible as your last tabindex that shifts the focus to the first element or it goes into the browser stuff. Heres an example of what the page looks like with the added info.. http://pastebin.com/2izkBt7g (works in page, not popup?) also, when posting probs with Chrome its a good idea to say what version your testing in. – PAEz Jan 31 '12 at 08:37
  • Hi Wladimir. Thanks very much for the tip. I've implemented this in my popup and I'm using Chrome 17.0.963.46 beta-m. Unfortunately, the cursor still disappears after the first tab key press. I can successfully get the 2nd tabindex to be selected upon loading the popup, but the 2nd key press results in a missing cursor once again. Do you think this could just be a bug with Chrome? – forgetso Jan 31 '12 at 18:52
  • It worked for me, in the stable version. The cursor doesn't disappear, everything is working exactly the way you'd expect it to. – Maxime Kjaer Feb 02 '12 at 20:47
  • It must be related to the most recent version of Chrome as it is also working for me in version 16.0.912.77 m. – forgetso Feb 06 '12 at 11:10
  • 1
    It has to be related to something introduced by chrome. As I am positive that my extension worked with the tab key before the newest. As of 18 beta-m its still broken so not sure what to do about it... – Ryan Feb 28 '12 at 18:55
  • Please, please, could an extension author who has code that demonstrates this issue file a bug report with the Chrome team? Other extensions have the same problem, but it's not clear to me that the Chrome devs know about it...? –  Mar 03 '12 at 12:53
  • I have also added comment at http://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20Area%20Feature%20Status%20Owner%20Summary&groupby=&sort=&id=122352. I would request you to go and vote for the issue so it can gain high priority. – Muhammad Adeel Zahid May 28 '12 at 07:49

2 Answers2

6

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.

trinth
  • 5,919
  • 9
  • 40
  • 45
  • 1
    Bug is back, hasn't been refixed yet: https://code.google.com/p/chromium/issues/detail?id=122352 – Loren Sep 04 '13 at 01:01
0

This appears to be working in Chrome Version 32.0.1700.76 m.

I have never seen it working properly for my TxtPad extension, but today it worked after the chrome update.

Hope it remains like that now.

Sumant
  • 2,201
  • 1
  • 16
  • 13