Sidebar Plugin: Need 'allow-modals' for window.confirm() to work

  • 3 October 2023
  • 3 replies

  • Conversationalist
  • 1 reply

My sidebar plugin has some interactions that invoke confirmations via `window.confirm()`, e.g. deleting a line item pops up “Are you sure?” type messages.

These currently don’t work when viewing app in Front’s iframe sidebar, and I believe it’s because the “allow-modals” permission is not set on the iFrame sandbox.

Can this be added?


Best answer by jason 4 October 2023, 00:40

View original

3 replies

Userlevel 3
Badge +6

Hi Jim,

You may want to raise this feature suggestion in our Product Ideas portal

In the meantime, you should be able to implement a popover component that doesn’t require the window.confirm() interaction. This shadcn UI Dialog component is a great example of how you could accomplish this

Thanks, Jason.  I posted it over there, but I’m concerned that looks more like a place to suggest new features that the community would upvote and be excited about.

This ain’t that.

This is more like something that was probably missed because it’s… well it’s easy to miss, and when you run into it, it’s more like a bug, rather than lack of a cool new feature.  I _could_ bring in a custom implementation of alerts/confirmation dialogues, but that would be a not insignifcant side track/cost on my end - and any other developer’s end that would run into this challenge.

I’m trying to ship features for my client ( your customer! :D ) and it would be VERY helpful if the iframe had “allow-modals” added to the list of permissions.  Whether it’s optional in the plugin configuration, or just added as default - I can’t imagine it represents any sort of challenge for the engineering team at Front.

Pretty please?

Userlevel 3
Badge +6

Hi Jim,

The Product Ideas portal is the right place to request both new features, and the addition of features you feel are missing. Our Product team reviews all new requests submitted there. 

If memory serves me correctly, it may have been intentional that this was not implemented, due to the fact that window.alert and window.confirm appear on the top level window (i.e. overlaid on the primary Front UI), rather than being restricted to the iframe where the plugin is hosted (see this JSFiddle as an example).
Using a pre-built dialog/modal library like the one I shared above may be the fastest path to a resolution here.