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

SideNavMenu isSideNavExpanded prop not working #4669

Closed
1 of 2 tasks
gptt916 opened this issue Nov 13, 2019 · 6 comments
Closed
1 of 2 tasks

SideNavMenu isSideNavExpanded prop not working #4669

gptt916 opened this issue Nov 13, 2019 · 6 comments

Comments

@gptt916
Copy link
Contributor

gptt916 commented Nov 13, 2019

What package(s) are you using?

  • carbon-components
  • carbon-components-react

Detailed description

Describe in detail the issue you're having.

When using SideNavMenu component, passing a boolean value as isSideNavExpanded has no effect on the rendered result

Is this issue related to a specific component?

Yes

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

I would like to see the component respond to the prop as described in the documentation.

What browser are you working in?

Firefox, Chrome

What version of the Carbon Design System are you using?

Latest

What offering/product do you work on? Any pressing ship or release dates we
should be aware of?

IBM Cloud Docs

Steps to reproduce the issue

  1. Use the component passing in true to isSideNavExpanded

Additional information

https://codesandbox.io/s/codesandbox-wc712?fontsize=14

@jendowns
Copy link
Contributor

jendowns commented Nov 15, 2019

Yeah just wanted to confirm that we are seeing this as well in IBM Security -- SideNavMenu doesn't appear to maintain/update state correctly? 🤔 I don't see the isExpanded state being updated as I manually open/close the menu -- it's always false.

Moreover, what is the difference between defaultExpanded and isSideNavExpanded? Neither of them appear to work for us, either.

cc @joshblack @asudoh have either of you seen this as well?

@asudoh
Copy link
Contributor

asudoh commented Nov 18, 2019

Seems that isSideNavExpanded represents the expanded state of side nav, instead of "category" type of side nav item - But the former seems to control the latter somehow. Not sure if the original author intended that or not.

@aagonzales Should the left drawer being shown/hidden (expanded/collapsed) affect the side nav item (category) being expanded/collapsed?

@aagonzales
Copy link
Member

aagonzales commented Nov 18, 2019

Sorry, I'm not sure I'm following. I'm only seeing a dropdown in the codepen demo and nothing concerning the sideNav. Could some do a screen recording of what's happening maybe?

@gptt916
Copy link
Contributor Author

gptt916 commented Nov 18, 2019

The dropdown is the sidenav, I have passed a boolean true to the prop isSideNavExpanded but the rendered nav is not expanded. Clicking on it ('This should be expanded') will expand it.

Essentially there is no way to control whether the dropdown (sidenav) is expanded, except through actual clicks. Cannot link the expanding/collapsing with other functionalities.

@asudoh
Copy link
Contributor

asudoh commented Nov 19, 2019

@aagonzales Sorry for the hard-to-understand question. I figured it out - The logic around isSideNavExpanded seems to have been for #3527, which requests side nav menu closed when it gets in "rails" mode (collapsed side nav).

Note to devs: It means that isSideNavExpanded is not for application-level control of side nav menu's expanded state.

@jendowns Unless we don't want to have side nav menu open again when side nav is back expanded, change in isSideNavExpanded shouldn't update state.isExpanded and we can make isSideNavExpanded simply affect the className logic (to force the side nav menu collapsed in "rails" mode) (Edit: I'm guessing this can be achieved simply by CSS even, without using isSideNavExpanded prop). In case otherwise, we can fix the state update logic to correctly represent what we want with the "rails" mode.

@tw15egan
Copy link
Member

After updating to the latest version of v10, this can be controlled with the defaultExpanded prop on SideNavMenu. Here is an example: https://codesandbox.io/s/codesandbox-forked-xtdegu?file=/src/index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

8 participants