From 44f85c686fedaa364a40c6c1fa8d996b9c2f27d2 Mon Sep 17 00:00:00 2001 From: Douglas Costa Rossi Date: Fri, 24 Jul 2026 18:13:40 -0300 Subject: [PATCH] fix(ObjectPage): re-expand header on tab switch in IconTabBar mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In IconTabBar mode, switching tabs while the header was collapsed by scrolling left the header permanently stuck — scrollTop was reset to 0 but headerCollapsed remained true with no scroll room to trigger re-expansion. Reset headerCollapsedInternal to false on tab switch so the header expands naturally alongside scrollTo({ top: 0 }). The existing scrollTimeout guard in useObserveHeights already prevents the programmatic scroll from immediately re-collapsing it. Also removes the redundant scrollTimeout clause from the spacer height condition, which was suppressing scroll room during the tab switch window. --- .../components/ObjectPage/ObjectPage.cy.tsx | 30 +++++++++++++++++++ .../main/src/components/ObjectPage/index.tsx | 5 ++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/packages/main/src/components/ObjectPage/ObjectPage.cy.tsx b/packages/main/src/components/ObjectPage/ObjectPage.cy.tsx index e7ccc502041..e02ac5a6729 100644 --- a/packages/main/src/components/ObjectPage/ObjectPage.cy.tsx +++ b/packages/main/src/components/ObjectPage/ObjectPage.cy.tsx @@ -1931,6 +1931,36 @@ describe('ObjectPage', () => { cy.findByText('Custom Header Section Two').should('not.be.visible'); cy.findByText('Subsection1').should('be.visible'); }); + + it('IconTabBar: header re-expands after tab switch when header was collapsed by scrolling', () => { + cy.viewport(1440, 900); + cy.mount( + + +
section 1 content
+
+ +
section 2 content
+
+
, + ); + cy.wait(50); + + // scroll down far enough to collapse the header + cy.findByTestId('op').scrollTo(0, 800); + cy.get('[data-component-name="ObjectPageHeaderContent"]').should('not.be.visible'); + + // switch tabs — header should re-expand and scroll should reset to top + cy.get('[ui5-tabcontainer]').findUi5TabByText('Section 2').click(); + cy.wait(600); + cy.get('[data-component-name="ObjectPageHeaderContent"]').should('be.visible'); + }); }); const DPTitle = ( diff --git a/packages/main/src/components/ObjectPage/index.tsx b/packages/main/src/components/ObjectPage/index.tsx index c980801409a..657fd4b237f 100644 --- a/packages/main/src/components/ObjectPage/index.tsx +++ b/packages/main/src/components/ObjectPage/index.tsx @@ -322,9 +322,9 @@ const ObjectPage = forwardRef((props, ref } return newSelectionSectionId; }); - // Reset scroll for section swap; scrollTimeout preserves current header collapsed/expanded state. if (mode === ObjectPageMode.IconTabBar) { scrollTimeout.current = performance.now() + 500; + setHeaderCollapsedInternal(false); objectPageRef.current?.scrollTo({ top: 0 }); } setTabSelectId(newSelectionSectionId); @@ -897,8 +897,7 @@ const ObjectPage = forwardRef((props, ref style={{ height: ((headerCollapsed && !headerPinned) || scrolledHeaderExpanded) && - !toggledCollapsedHeaderWasVisible && - !(mode === ObjectPageMode.IconTabBar && scrollTimeout.current >= performance.now()) + !toggledCollapsedHeaderWasVisible ? `${headerContentHeight}px` : 0, }}