Semantic-UI-React icon indicating copy to clipboard operation
Semantic-UI-React copied to clipboard

Menu labels cause sub-menus and items to mis-align

Open k-vosswinkel opened this issue 7 years ago • 4 comments

Bug Report

When using a label on a menu and attaching it to the top of the menu, only the first child of the menu re-sizes its height appropriately. All other children fill the entire height, causing mis-alignment of text, etc...

Steps

Create a menu with a label and several items or sub-menus e.g.:

<Menu inverted attached size="large" className={cx( 'menu' )}>
	<Label attached="top" color="yellow" />
	<Menu.Item name="Home" as={Link} to="/home" />
	<Menu.Item name="Edit" as={Link} to="/edit" />
	<Menu.Menu position="right">
		<Menu.Item name="Logout" onClick={onClick} />
		<Menu.Item name="Reset" onClick={onClick} />
	</Menu.Menu>
</Menu>

Expected Result

A label with menu items aligned under it

Actual Result

The actual result that happened 💣 The first menu item is aligned correctly and the others are not Screen Shot 2019-09-20 at 12 03 10 PM

Version

0.88.1

Testcase

https://codesandbox.io/embed/semantic-ui-react-856i7

k-vosswinkel avatar Sep 20 '19 16:09 k-vosswinkel

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

welcome[bot] avatar Sep 20 '19 16:09 welcome[bot]

Hey there :) It seems like the first menu item (or the first item after the label in general) is somehow treated as first child of the label, thats why only the first item is aligned correctly semanticuireact_menu+label

Workaround You can put your menu items into a container to align them correctly: https://codesandbox.io/embed/semantic-ui-react-dg01i

semanticuireact_menu+label_alignedcorrectly

Tamiira avatar Oct 27 '19 18:10 Tamiira

Thanks @Tamiira - the workaround is definitely helpful, I just wanted to flag because it seems like we should be able to have more than one child in a menu based off the docs.

k-vosswinkel avatar Oct 28 '19 21:10 k-vosswinkel

Hi @k-vosswinkel!

Label is technically a valid child of Menu when using the subcomponent API. The CSS in Semantic-UI does not know how to deal with that markup.

I am making a guess on what you are trying to achieve from your Codesandbox... but this would be something better achieved by just defining a style directly to the menu to get that top strip of color instead. I forked your example to show this. https://codesandbox.io/s/semantic-ui-react-yhvhq

brianespinosa avatar Oct 30 '19 21:10 brianespinosa