How to autofocus an input field in a popup?

Hi,

I would like to open a popup (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/user_interface/Popups) that includes a list and an input field which could filter this list.
What I can’t get to work is, that I want the user to be able to immediately type something into this input field. I want the popup to get the focus, but I seem to only get it when I click in it.

Anyone has an idea how to achieve this or is it not possible?

Maybe the autofocus attribute does the job :wink:
<input type="text" name="name" autofocus>

:slight_smile: Well, I tried it and it did not work.
Also tried it via javascript with focus().

There is an issue with focus when moving between tabs and popus (browser, page, sidebar).

At the moment it is possible to change the active tab from/to popups but not the focus.
I spent a lot of time on trying to change the focus from sidebar to the tab. Although the text was highlighted but it wouldn’t show since the tab although active didn’t get a focus. Clicking on another tab and back to the target tab showed the selected text.

I suspect it is the same situation from Tab to the popup.

Hm, ok, so do you know if there is a issue report for this already?

A few related to focus

https://bugzilla.mozilla.org/show_bug.cgi?id=1402227
https://bugzilla.mozilla.org/show_bug.cgi?id=1391942
https://bugzilla.mozilla.org/show_bug.cgi?id=1341416

Thanks!

FYI, If anyone else is looking for this, I think this is currently the corresponding bug report:
https://bugzilla.mozilla.org/show_bug.cgi?id=1324255