Jira Cloud WebPanel - how to add and remove <iframe> on WebPanel open and close



when adding a webPanel to Issue Details Page with "location": "atl.jira.view.issue.left.context", an <iframe> for the webPanel is being added to the DOM or removed from the DOM automatically every time user shows or hides add-on respectively.

At the same time, a webPanel with "location": "atl.jira.view.issue.right.context" has it’s <iframe> always in the DOM regardless of its visibility status. Namely, opening/ closing webPanel does not add/ remove <iframe> element to/from the DOM. This causes REST API calls triggered by mentioned webPanel, even if it is closed (which I want to avoid).

I’d like to make webPanel with "location": "atl.jira.view.issue.right.context" to behave the same as webPanel with "location": "atl.jira.view.issue.left.context", meaning that <iframe> for webPanel with "location": "atl.jira.view.issue.right.context" will be added to DOM or removed from DOM respectively on webPanel show/ hide .

QUESTION: how to achieve such a behavior? Is it possible at all?

I feel like you are explaining what you want instead of why you want it. You mentioned that webPanels are sending REST API calls even if nobody interacts with them…why is that happening?

REST API call is made to get data that is being rendered inside webPanel.
This particular webPanel is Angular application that calls REST API on its root component initialisation. Initialisation takes place when <iframe> is being added to DOM.

As a result such a situation takes place:

  • I enter Issue Details
  • my webPanel in right.context is collapsed (I don’t need to make REST API call since I don’t interact with my webPanel, I don’t need to render any data)
  • but because <iframe> for webPanel is already in DOM, REST API call is being made automatically

This seems like a good thing. It means that, if a user does click on your iframe, that all of their data will already be loaded. It will be super performant from their perspective.

However, if you really want to wait until the user can see your web panel I’m not sure what can be done. You could try investigating Interaction Observers to see if they can help with an “Is Visible” check.