question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React does not recognize the `isSideNavExpanded` prop on a DOM element

See original GitHub issue

What package(s) are you using?

  • carbon-components - 10.6.1 (latest)
  • carbon-components-react - 7.6.1 (latest)

Detailed description

Describe in detail the issue you’re having.

It looks like https://github.com/carbon-design-system/carbon/pull/3626 introduced a warning about unrecognized props being applied to DOM elements.

Warning: React does not recognize the `isSideNavExpanded` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `issidenavexpanded` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in a (created by Context.Consumer)
    in Link (created by Context.Consumer)
    in NavLink (created by Link)
    in Link (created by ForwardRef(SideNavMenuItem))

here, the props (including isSideNavExpanded) are being spread onto element: https://github.com/carbon-design-system/carbon/blob/99f12f98e226b2ab1872b7379167d827e4fe7bd5/packages/react/src/components/UIShell/Link.js#L19

Is this issue related to a specific component?

What did you expect to happen? What happened instead? What would you like to see changed?

The Carbon components should not be passing through all props like this, instead they should filter out those that are not supported / relevant for the target component / element, or explicitly pass only the expected props to their children.

Having these warnings causes a lot of noise in logs, both in the browser and in tests, making it harder to spot / debug genuine problems.

Steps to reproduce the issue

This can be reproduced by running the storybook in dev mode

  1. from packages/react: npm run storybook
  2. navigate to http://localhost:9000/?path=/story/ui-shell--fixed-sidenav
  3. see the warning in the browser console

image

Please create a reduced test case in CodeSandbox

Additional information

  • Screenshots or code
  • Notes

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kubijocommented, Mar 19, 2021

If I understood it correctly this should be the link https://codesandbox.io/s/magical-clarke-ldj9i?file=/src/index.js

1reaction
emyarodcommented, Mar 19, 2021

@kubijo would you mind sharing a reduced test case in a ZIP if Code Sandbox is still not playing nice?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React does not recognize the X prop on a DOM element ...
The problem is <div {...props}> in MyWrapper ; that adds the handleMoveAll prop onto the div. What you could do is something like:...
Read more >
React does not recognize the `isSideNavExpanded` prop on a DOM ...
Describe in detail the issue you're having. It looks like https://github.com/carbon-design-system/carbon/pull/3626 introduced a warning about unrecognized props ...
Read more >
Warning: React does not recognize the `isOpen` prop on a DOM
prop on a DOM element. i got solved this issue. just change tag to Navlink because ActiveClassName is just suported Navlink.
Read more >
React does not recognize the XYZ prop on a DOM element. If ...
Hey fellow React devs, I just recently migrated from CRA to NextJS and getting the following warning in the console when trying to...
Read more >
carbon-addons-iot-react | Yarn - Package Manager
All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines. 2.151.1 (2022-11-04). Bug Fixes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found