I believe your goal is as follows.
- You want to move the focus from the sidebar to Google Document.
In this case, how about using "editor.focus()" of Class google.script.host?
https://developers.google.com/apps-script/guides/html/reference/host#editor.focus()A sample script is as follows. Please copy and paste the following script to the script editor of Google Document and run "openSidebar" function. By this, a sidebar is opened. When you click "ok" button, the focus it moved from the sidebar to Google Document.
function openSidebar() {
const html = HtmlService.createHtmlOutput('<input type="button" value="ok" onclick="google.script.host.editor.focus()">');
DocumentApp.getUi().showSidebar(html);
}
If I misunderstood your goal, I apologize.