I have implemented a Tabs component with three tab headers and their corresponding content sections. By default, the first tab and its content are displayed. The second and third tabs are shown only when the user is an Application Owner (using an If condition on the tab headers). The tab headers are displayed correctly based on the user's role. However, when I click the second or third tab, the tab header becomes active, and I can see that the ActiveTab input is changing correctly in the TabsOnTabChange action during debugging. The issue is that the content area always displays the content of the first tab, even though the ActiveTab value is updated correctly. Interestingly, if I remove the If conditions that control the visibility of the second and third tabs, everything works as expected and the correct content is displayed. Has anyone encountered this issue before? Is there any limitation or best practice when using conditional visibility (If) with tab headers in OutSystems? Any suggestions would be appreciated. Thanks!
You’ve run into a known limitation/quirk of the Tabs pattern when you use IF widgets to conditionally render tab headers and/or contents.
What’s happening:
TabsHeaderItem
TabsContentItem
Because of this, using IF to completely remove certain headers/contents is not supported very well and can break the header–content alignment.
Instead of wrapping TabsHeaderItem / TabsContentItem in IFs, keep all three tabs rendered, and control visibility via CSS classes:
Remove the IFs around the header and content items.
Add a conditional class to the ExtendedClass of both TabsHeaderItem and TabsContentItem, for each tab that should be “hidden” for non–Application Owners:
If(IsApplicationOwner, "", "hidden")
In newer versions, .hidden might be overridden by the Tabs’ own CSS (e.g. .tabs .tabs-header-tab { display: flex; }). If that happens, add a custom rule to your theme or page stylesheet:
.hidden
.tabs .tabs-header-tab { display: flex; }
.tabs .tabs-header-tab.hidden { display: none; }
This ensures the header is truly not visible even though the item still exists in the DOM, so the Tabs js logic keeps its internal index mapping correct. If in tabs is bugged
Do the same for the content items (either reuse .hidden or another class) so the “forbidden” content is also not shown.
With this approach:
ActiveTab
ActiveTabAsIndex
If you align your implementation with the pattern above, your ActiveTab value will stay in sync with the content, and the second/third tabs will display their proper content even when only visible for Application Owners.