segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

The menu has no menu items #1223

Closed mifi closed 2 years ago

mifi commented 3 years ago

I get this error if I use the disabled prop for Menu.Item and if all menu items in a Menu.Group are disabled. Can we remove this line of code?

https://github.com/segmentio/evergreen/blob/29f9c41ff15527dac0892330b8032ccd585b1412/src/menu/src/Menu.js#L29

Maybe instead return? I can submit a pr if this is the correct solution

akleiner2 commented 3 years ago

I'd be fine either removing that line, or just throwing that error in dev -- happy to accept a PR either way.

dudhatdhavalm commented 3 years ago

Is this issue still open or not? if it is still open then I would like to do my first contribution.

mifi commented 3 years ago

Still an issue. Feel free to contribute :) IMO the line should be removed, or the code that counts menu items should include disabled menu items in the count. This bug is a very sneaky one because it seems to work fine, until you happen to end up in a state where all menu items are disabled (or the single item, if just one), then it will crash!

brandongregoryscott commented 2 years ago

Published with v6.7.1