openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

sapFShellBarHomeIcon does not specify width which causes a layout shift

Open kohlerm opened this issue 3 years ago • 6 comments

OpenUI5 version:

Browser/version (+device/version): Tested with Chrome 111.0.5563.65 on Windows 11, but most likely applies to all Browsers and operating systems.

The element styled by sapFShellBarHomeIcon almost always contains an image, but the rule does not specify a width. This causes a layout shift during rendering. This can be verified by running Lighthouse in the chrome devtools. For reference see https://www.smashingmagazine.com/2021/06/how-to-fix-cumulative-layout-shift-issues/.

kohlerm avatar Mar 17 '23 13:03 kohlerm

Hello @kohlerm,

Could you please provide an isolated example of the reproducible issue in, for example, JSBin?

Thank you in advance!

JumpNRun avatar Mar 17 '23 16:03 JumpNRun

sample.ShellBarWithMenuButton.zip Sample project adapted from https://ui5.sap.com/#/entity/sap.f.ShellBar/sample/sap.f.sample.ShellBarWithMenuButton Not sure how to condense this to a JSBin example. Running Chrome Lighthouse you will find: image

kohlerm avatar Mar 21 '23 12:03 kohlerm

`.sapFShellBar .sapFSHMegaMenu { display: flex; align-items: center; font-weight: bold; overflow: hidden; }

.sapFShellBar .sapFSHMegaMenu .sapMBtnInner > img { height: 2rem; width: auto; max-width: 100%; }

.sapFShellBar .sapFSHMegaMenu .sapMBtnInner::after { content: '\E287'; font-size: 1rem; line-height: 2.2rem; font-weight: bold; }

.sapFShellBar .sapFShellBarHomeIcon { height: 2rem; vertical-align: middle; } .sapFShellBar .sapFShellBarPrimaryTitle { overflow: hidden; text-overflow: ellipsis; background: transparent; color: #ffffff; font-size: 0.875rem; line-height: 2.75rem; vertical-align: middle; font-weight: bold; white-space: nowrap; max-width: 200px; /* or whatever fixed width you want to use */ } ` fixes the problem

kohlerm avatar Mar 21 '23 13:03 kohlerm

Hi, Thank you for the additional information. I've created an internal incident 2370025208. The status of the issue will be updated here in GitHub.

JumpNRun avatar Mar 24 '23 15:03 JumpNRun

Hello @kohlerm,

I understand the concern but this image is user defined therefore it can have different size and we cannot hard-code the dimensions in the implementation.

Do you mean it would be better to pass width and height settings for this image to the underlying image control? The application side could do this as they should already know the dimensions of the image used.

Thanks and best regards, Jordan

jdichev avatar Apr 07 '23 12:04 jdichev

No response for quite a while so I close this issue. Please reopen if there is new information or development on this topic.

jdichev avatar May 26 '23 10:05 jdichev