Panel Focusing

I have a Photoshop UXP plugin with various controls including a cancel button. The cancel button is to allow the user to back out if they change their mind about whether they want to use the plugin at this stage, as such it is the first button to be clicked. The button needs a double click to activate whereas all other buttons need a single click. It seems as if the first click is need to activate the panel and the second click to activate the cancel. If I, for example, click a tick box first then, the cancel button activates on the first click.

I have consulted various AI tools and they all offer solutions such as

panel.show(); 
panel.focus(); 

or

cancelButton.focus()

Some also recommend solutions of the form 

document.addEventListener("DOMContentLoaded", function()

but none of this works.