ObjectPageLayoyt: Skip Sub-Section to Section promotion
@kineticjs is already working on this.
Since Aug 31, 2026.
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Why are you proposing this feature?
I’ve been asked multiple times to support Sections that contain only a single Sub-Section, with both levels displayed in the IconTabBar.
This usually comes from business requirements related to phased rollouts, where new Sub-Sections are added over time. From the start, they want to preserve the overall app structure (Sections), even if some of them initially contain only one Sub-Section.
As a result, both the Section and its single Sub-Section need to remain visible, rather than promoting the Sub-Section to replace the Section.
Until now I've always extended the control the same way, or tricking the control by using "invisible" Sub-Sections to achieve this behavior. But it would be nice if the framework supported this feature by default.
How should a possible solution look like?
- /sap/uxap/ObjectPageLayout.js
add property "skipSubSectionPromotion" into the metadata as boolean with defaultValue: false
skipSubSectionPromotion: {type: "boolean", defaultValue: false},
- /sap/uxap/ObjectPageLayoutABHelper.js
replace
if (aSubSections.length > 1) {
for
if (aSubSections.length > 1 || oObjectPage.getSkipSubSectionPromotion()) {
ABHelper.prototype._buildAnchorBar = function () {
var oObjectPage = this.getObjectPageLayout(),
oIconTabHeader = this._getAnchorBar(),
bUpperCase = oObjectPage.getUpperCaseAnchorBar();
this.resetControl();
this._oObserver.disconnect(); // unobrveserve all previousy obsed objects
oObjectPage._getVisibleSections().forEach(function (oSection) {
var sSectionFilterId = oIconTabHeader.getId() + "-" + oSection.getId() + "-anchor",
oSectionFilter = new IconTabFilter(sSectionFilterId, {
text: ManagedObject.escapeSettingsValue(oSection._getTitle()),
key: oSection.getId(),
iconColor: ManagedObject.escapeSettingsValue(oSection.getAnchorBarButtonColor())
}),
aSubSections = oSection._getVisibleSubSections();
this._setupCustomButtonForwarding(oSection, oSectionFilter, bUpperCase);
if (oObjectPage.getShowAnchorBarPopover()) {
// if (aSubSections.length > 1) {
if (aSubSections.length > 1 || oObjectPage.getSkipSubSectionPromotion()) {
aSubSections.forEach(function (oSubSection) {
var sSubSectionFilterId = oIconTabHeader.getId() + "-" + oSubSection.getId() + "-anchor",
oSubSectionFilter = new IconTabFilter(sSubSectionFilterId, {
text: ManagedObject.escapeSettingsValue(oSubSection.getTitle()),
key: oSubSection.getId()
});
oSectionFilter.addItem(oSubSectionFilter);
this._setupCustomButtonForwarding(oSubSection, oSubSectionFilter);
}, this);
} else if (aSubSections.length === 1 && !oSection.getCustomAnchorBarButton() && aSubSections[0].getTitle()?.trim()) { // promoted section
// When SubSectionLayout is TitleOnLeft, the SubSection title is shown in the AnchorBar, when there is only one SubSection and it has title
oObjectPage.getSubSectionLayout() === ObjectPageSubSectionLayout.TitleOnLeft
&& oSectionFilter.setText(ManagedObject.escapeSettingsValue(aSubSections[0].getTitle()));
this._setupCustomButtonForwarding(aSubSections[0], oSectionFilter, bUpperCase);
}
}
oIconTabHeader.addItem(oSectionFilter);
}, this);
oObjectPage.setAggregation("_anchorBar", oIconTabHeader);
};
- /sap/uxap/ObjectPageSection.js
ObjectPageSection.prototype._hasPromotedSubSection = function () {
var oObjectPage = this.getObjectPageLayout()
var skipSubSectionPromotion = oObjectPage.getSkipSubSectionPromotion()
if (skipSubSectionPromotion) return false
return this._bHasPromotedSubSection;
};
Are there alternative approaches?
No response
Any further information you would like to share?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.