I’m attempting to use an aui-toggle for my plugin. However, the aui-toggle is not visible unless the current user is either a Confluence or system administrator. I have tested this on both Confluence 7.4.18 and 8.7.1. The issue seems to be that the files named ‘batch.css’ and ‘batch.js’ are only loaded when I log in as a system administrator. These files are critical for both the visibility and functionality of the aui-toggle. When I log in as a normal user, these files are absent. Even if I manually add the CSS, it does not work because the corresponding .js file is also missing. Therefore, the issue likely stems not from the aui-toggle itself but from the question: ‘Can’t non-administrator users access that batch.css/batch.js?’ Is there a permission setting that controls this?
What I’m pretty sure is happening is that Confluence is specifically only loading JS+CSS when they’re actually used on the page (web resources) i.e. conditionally. This improves performance, if we were to load all JS and CSS on every page it would be hundreds of megabytes. I can’t be sure without you providing more details like a specific page, version of Confluence, state of plugins, etc. i.e. reproduction step.s
It sounds like you’ll need to declare a web-resource dependency on
which you can find here: Toggle buttons - AUI Documentation
If there’s a missing web-resource dependency it’s a bug. Just because it happens to work sometimes doesn’t mean it will work all the time, i.e. it may not work for customers. The Web-Resource Manager (what loads web-resources on a page) can only ensure that the dependencies needed are ready before code executes if the dependencies are entirely declared to it.
Thanks, I haven’t thought about the adding web-resource dependency since I thought it’s some kind of permission issue. It solved my problem.