Link to home
Start Free TrialLog in
Avatar of Ankur Gupta
Ankur Gupta

asked on

Google Docs: Close both "Dialog and Sidebar" client side on single click

I am using google.script.host.close() twice on my client html page for closing both dialog and sidebar in Google docs using this JS snippet:

   
   function CloseAll() {
      google.script.run
        .withSuccessHandler(google.script.host.close) //for dialog
      google.script.run
        .withSuccessHandler(google.script.host.close) //for sidebar
    }

Open in new window


This is resulting in closing only the dialog.
I also noticed that after the dialog closes, the focus shifts to Google docs Editor, and I presume that this may be the reason that sidebar is not closing as it has no focus.

I am also unable to change focus back to the sidebar, except when I reopen the sidebar. (But reopening the sidebar does not work for my scenario).

How can I close both the dialog and the sidebar together?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.