Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-menu): prevent global line-height inheritance #10916

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

hinzzx
Copy link
Contributor

@hinzzx hinzzx commented Feb 20, 2025

Previously setting a line-height property on global level e.g body { line-height: 0.5rem } was being inherited by the ui5-menu and its ui5-menu-item's which was not convenient.

With this chnange we now prevent the global inheritance of the line-height with the following priority:

ui5-menu-item > ui5-menu > global (globally no longer takes effect), which means if a line-height is set to the ui5-menu, all of its children (ui5-menu-items) would receive the effect, but if a specific ui5-menu-item receives the property, it would take over.

For example, here all children, except the first one (which has explicitly set style="line-height: 0.5rem;") would have line-height of 1rem

	<ui5-menu style="line-height: 1rem;" header-text="Basic Menu with Items" id="menuBasic" opener="btnOpenBasic">
		<ui5-menu-item style="line-height: 0.5rem;" text="New File" icon="add-document"></ui5-menu-item>
		<ui5-menu-item text="New Folder" icon="add-folder" disabled></ui5-menu-item>
		<ui5-menu-item text="Save" icon="add-folder" disabled></ui5-menu-item>
	</ui5-menu>

Before

2025-02-20_16-11-36

After

2025-02-20_16-11-50

Fixes: #10754

@hinzzx hinzzx marked this pull request as ready for review February 20, 2025 14:21
@hinzzx hinzzx merged commit f6682b2 into main Feb 20, 2025
12 checks passed
@hinzzx hinzzx deleted the menu-line-height-fix branch February 20, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ui5-menu]: line-height set to body should not influence menu items
2 participants