Firefox internals: What technically differenciates a hot key/command popup opening from click opening?

(rugk) #1

I hope this question gets passed to some Firefox devs or so, as this is really a question about specific internals here.

So let’s get started…

Background: The problem

I have an emoji picker add-on. Internally it uses React (actually, preact) and this emoji picker library.

So now that emoji picker lib has a feature to auto-focus the input box, which I’ve enabled.
This also works, when I click the browser action button as usual.

However when I use the_hot key_ to trigger the popup opening, it always fails and does not auto-focus the input field.

The hot key is defined in the simplest possible way via the commands key in the manifest.json. I.e. live code here:

The question

So obviously I wonder why that behaviour is so different?
It’s exactly the same code/HTML that is called, just a slightly different way to trigger it – which is outside of the scope my extension can influence, however. So it is really some strange Firefox behaviour.

So, can you tell me what differences there are when I open the popup via a click vs vis the hot key? (IMHO it should behave the same, i.e. there should be no differences)
But appearently there are…

PS: Issue tracked as #28 “downstream”/in my add-on.

System: Firefox Nightly 68.0a1 Linux/Fedora 30 (Wayland)

…, but IIRC I could reproduce it with stable Firefox, too and on other systems, too.