Toggle Button Jira 7.0.0

Hello,

I’m trying to use a Toggle Button in my plugin.
When the plugin runs on Jira 7.6.1 everything works fine, although, if I test on Jira 7.0.0 the button is not showed but the element is created. I’ve already added the Web Resource to my atlassian-plugin.xml.

Any ideas how to solve this?

The toggle button was introduced in AUI 5.9 (https://docs.atlassian.com/aui/7.0.0/docs/toggle-button.html ). According to https://bitbucket.org/atlassian/aui-adg/wiki/versions/product-version-matrix AUI 5.9 wasn’t used until Jira 7.2. In this case you’d probably need to create your own version of the toggle button if you want to have it in Jira 7.0.

2 Likes

I’ll +1 @daniel’s answer; since a version of AUI with the toggle button wasn’t included in Jira 7.0, the web-resource dependency won’t be there, nor the component.

With respect to building your own toggle button: if you’re using Node-based tooling to build your front-end, one possible strategy would be to:

  • Depend upon the @atlassian/aui module as a dependency in your package.json file;
  • Import the lib/js/aui/toggle.js and lib/css/aui-toggle.css files directly in to your code.

This approach has its tradeoffs. On the plus side, all the UI components you need are now packaged within your UI code, so the version of Jira (and the version of AUI it provides) won’t affect your code. On the downside, this has some redundancy and maintainability problems: your code would be tied to a specific version of the toggle component, so you’d not inherit updates to it for free; also this component might accidentally overwrite the one provided by Jira / AUI (since JavaScript is often a hot mess of global, order-dependent side-effects), which could cause odd problems at product runtime.

Needless to say, this situation isn’t ideal. The AUI team are aware that this cross-version compatibility problem exists, and would like to help improve the situation a little. We’re discussing ideas internally, but if you have suggestions for ways we could make your life a bit easier, we’re listening :slight_smile: