Shopify Polaris - Modal Overlay

Shopify Polaris modal overlay still visible after redirect to other page. So it is not possible to use header links/button after redirect.

I am facing the same issue too, for workaround, I called .hideOverlay() to hide the modal first, before redirecting.

@soulchild Ok, I will try this, Thanks!

Hey @Bhavin_Bhalodia - thanks for flagging this.

Did calling .hideOverlay() before redirecting resolve the issue for you as well?

To help us investigate, could you (or @soulchild) please share:

  • A minimal code example showing the modal component, how you open and close it, and the redirect handler.
  • Your Polaris and App Bridge package versions, or the CDN script URLs you’re loading.

Hello @Wes-Dev-Shopify
Thank you for reply. Please find my example code as per below.
Polaris version: 2.0
App Bridge version: 3710

Hey @Bhavin_Bhalodia - thanks for the example, it helped me reproduce this.

When the page loads https://cdn.shopify.com/shopifycloud/app-bridge.js along with polaris.js, opening the modal and moving the app to another page while it’s still open leaves the Shopify admin header and sidebar dimmed. The new app page still responds to clicks. I saw this with the App Bridge 3 Redirect.Action.APP call from your example, and with a plain window.location.assign() that doesn’t use App Bridge 3.

With only polaris.js and App Bridge 3.7.10 loaded, as in your snippet, the modal dimmed only the app area and the admin header worked after the redirect. Does your full page also load the CDN app-bridge.js script?

In my testing, closing the modal before redirecting avoided the stuck overlay. Calling hideOverlay() right before the redirect, as @soulchild suggested, worked, and so did waiting for the modal’s `afterhide` event:

window.goToPage = function (app_url) {
  const modal = document.getElementById('create_job');
  modal.addEventListener('afterhide', function () {
    Redirect.create(app).dispatch(Redirect.Action.APP, app_url);
  }, {once: true});
  modal.hideOverlay();
};

I’m sharing these repro steps and this report internally and will update this thread when I have more.