UXP panel: how do I reproduce, in script, the state where plugin and Premiere shortcuts both work?
Environment
- Premiere Pro 25.6.6 (Windows), same result with Premiere Pro 26.0.2
- Manifest v5, UDT 2.2
- Panel entrypoint, docked
Goal
A panel that reacts to numpad keys to trigger plugin actions, while the editor keeps using Premiere’s own shortcuts (playback, navigation, tools), without clicking back and forth between the panel and the timeline.
This state is reachable by hand. I cannot reach it from script, and that is what this post is about.
1. Baseline: no key events until a real click inside an <input>
document.addEventListener('keydown', (e) => console.log(e.key, e.code));
Key events start arriving once the user physically clicks inside an <input type="text"> or <input type="number">. A real click on a <button> is not enough — it has to be an <input>.
2. The manual sequence that works
- Click inside an
<input>and stay there → plugin shortcuts fire, Premiere’s own shortcuts are suppressed. - Then click on the panel background → both plugin and Premiere shortcuts respond.
Step 2 is the state I want. Note that it is host-priority rather than true simultaneity: any key already bound in Premiere goes to Premiere only, and the plugin listener never fires for it (G reaches console.log(e.key), J and K do not). That is fine for my use case.
3. Scripted attempts at step 2
Every combination below was tested from a clean state (Unload, then Load) and triggered from a real click on a <button>.
| Scripted sequence | Result | …then a manual background click |
|---|---|---|
input.focus() |
plugin only | both |
input.focus() + body.focus() |
plugin only | both |
input.focus() + input.blur() |
nothing | nothing |
input.focus() + setTimeout(100) + input.blur() |
nothing | nothing |
input.click() |
nothing | both |
input.click() + body.click() |
nothing | both |
Three things stand out:
- No scripted sequence ever reaches the “both” state on its own. A real mouse click on the background is always required for the final step.
input.focus()is not inert — it reliably reproduces step 1. So programmatic focus does something; it just cannot complete step 2.- Any
blur()leaves the panel unrecoverable. Not only does the panel receive nothing, but a subsequent manual background click does not fix it either — unlike every other row in the table.
Also worth noting: input.click() alone appears to do nothing, yet a manual background click after it reaches the “both” state — whereas a manual background click on a fresh panel does not. So .click() does change something, invisibly.
4. Related observations
Alt-tab. After alt-tabbing to another application and returning to Premiere, plugin shortcuts stop working. In that state — and only in that state — clicking into another Premiere panel and then back into the plugin panel restores them. The same manoeuvre does nothing on a freshly loaded plugin.
UDT Reload vs Unload + Load. These are not equivalent here. Reload behaves like an alt-tab (shortcuts lost, recoverable through the other-panel round trip); Unload + Load behaves like a cold start (only the full manual sequence works).
Questions
It is very akward to tell the client that he must click inside an input (or a “Activate keys” button which triggers a .focus()) then click on the panel background, and to repeat after each alt-tab.
Since it’s possible manually, is there a supported way to reach the state described in section 2 from script,where the panel receives key events and Premiere keeps its own shortcuts, without requiring the user to click on the panel background by hand? And if not, is the difference between a real background click and every scripted equivalent intentional? How does it work ?
If it’s not possible yet in UXP, is this possible in ExtendScript ? C++ by the SDK ? CEP ?
Thanks in advance,
Best regards,
David Traparic