Skip to content

Commit d0b9a32

Browse files
authored
fix(DynamicPageTitle): always show all contents of the 2nd line (#4489)
Fixes #4488
1 parent be34d88 commit d0b9a32

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

packages/main/src/components/DynamicPageTitle/DynamicPageTitle.cy.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useRef, useState } from 'react';
2-
import { DynamicPage, DynamicPageTitlePropTypes, ObjectPage } from '../..';
2+
import { DynamicPage, DynamicPageTitlePropTypes, ObjectPage, Title } from '../..';
33
import { Button } from '../../webComponents';
44
import { DynamicPageTitle } from './';
55

@@ -81,4 +81,22 @@ describe('DynamicPageTitle', () => {
8181
cy.wait(200);
8282
testOverflowRefs({ nav: 'false', actions: 'false' });
8383
});
84+
it('show 2nd line content', () => {
85+
cy.viewport(320, 700);
86+
[true, false].forEach((isObjectPage) => {
87+
cy.mount(
88+
<PageComponent
89+
isObjectPage={isObjectPage}
90+
dynamicPageTitleProps={{
91+
header: <Title>This is a pretty long title of the DynamicPageTitle</Title>,
92+
navigationActions: undefined,
93+
children: <div>Content</div>
94+
}}
95+
/>
96+
);
97+
cy.findByText('This is a pretty long title of the DynamicPageTitle').should('be.visible');
98+
cy.findByText('Content').should('be.visible');
99+
cy.get('[data-component-name="ToolbarOverflowButton"]').should('be.visible');
100+
});
101+
});
84102
});

packages/main/src/components/DynamicPageTitle/DynamicPageTitle.jss.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ export const DynamicPageTitleStyles = {
3333
padding: '0.5rem 0 0.25rem 0'
3434
},
3535
titleMainSection: {
36+
overflowX: 'hidden',
3637
flex: '1 1 100%',
3738
alignItems: 'baseline'
3839
},
40+
middleSection: { flexGrow: 1, width: '100%', overflowX: 'hidden' },
3941
title: {
42+
minWidth: '3rem',
43+
overflowX: 'hidden',
4044
fontFamily: ThemingParameters.sapObjectHeader_Title_FontFamily,
4145
color: ThemingParameters.sapObjectHeader_Title_TextColor,
4246
fontSize: `var(${DynamicPageCssVariables.titleFontSize})`,

packages/main/src/components/DynamicPageTitle/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ const DynamicPageTitle = forwardRef<HTMLDivElement, DynamicPageTitlePropTypes>((
245245
)}
246246
</FlexBox>
247247
)}
248-
<FlexBox alignItems={FlexBoxAlignItems.Center} style={{ flexGrow: 1, width: '100%' }}>
248+
<FlexBox
249+
alignItems={FlexBoxAlignItems.Center}
250+
className={classes.middleSection}
251+
data-component-name="DynamicPageTitleMiddleSection"
252+
>
249253
<FlexBox className={classes.titleMainSection}>
250254
{header && (
251255
<div className={classes.title} data-component-name="DynamicPageTitleHeader">

0 commit comments

Comments
 (0)