Hidden MenuItem in MenuList causes props warning
See original GitHub issueWhen a MenuList has a MenuItem wrapped by Hidden, a warning is generated.
Failed prop type: The following properties are not supported:
tabIndex
,onFocus
. Please remove them.
I believe MenuList sets those properties, so even if I wanted to not set them they would get set.
- This is a v1.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
A few issues are similar, but not exactly this issue: #12302 #12159 #11467.
Expected Behavior
The MenuItem should display on the correct screen resolution without producing warnings.
Current Behavior
The MenuItem produces warnings.
Steps to Reproduce
Link: https://codesandbox.io/s/y2vnzl1m8v
For example:
<MenuList role="menu">
<Hidden smUp>
<MenuItem onClick={() => {}}>
Menu Item
</MenuItem>
</Hidden>
<MenuItem onClick={() => {}}>
Menu Item
</MenuItem>
</MenuList>
Context
I want some menu items to display on small screen sizes. On large screen sizes they will appear as buttons outside the menu.
Your Environment
Tech | Version |
---|---|
Material-UI | v1.4.3 |
React | v16.3.2 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Hidden MenuItem in MenuList causes props warning #12468
When a MenuList has a MenuItem wrapped by Hidden, a warning is generated. Failed prop type: The following properties are not supported: tabIndex ......
Read more >How do I show which item in the Menu List is selected with ...
So the solution is to check if the current location(url) is matched with the menu item's target url. If matched, the selected prop...
Read more >MenuItem API - Material UI - MUI
Name Type Default
autoFocus bool false
children node
classes object
Read more >Menu Button - Reach UI
MenuItem element props All props are spread to the underlying element. In this example the onFocus prop is passed down to the element....
Read more >MenuItem - React menu component - szhsin/react-menu
It makes the menu list scrollable or hidden when there is not enough ... Warning: don't update this prop in rapid succession, which...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for that example. It’s very helpful.
Also, if the internal API can change so this work-around isn’t needed, even better.