Patternfly-react: NavExpandable does not expand or collapse programmatically

Created on 5 Dec 2018  路  4Comments  路  Source: patternfly/patternfly-react

If the NavExpandable component prop isActive is set to true, it would be great to have an option to expand it automatically.

Setting the value of isExpanded to true or false does not expand or collapse the nav list items. When NavToggle is manually selected, it calls this.setState({ value: !value }); from within handleToggle. This successfully toggles the NavExpandable open and close. We would like to be able to set the value of isExpanded programmatically by passing/setting props. Currently, this option isn't available.

nav bug

PF4 enhancement p1

Most helpful comment

@rhamilto - Just reopened. Thanks for the additional detail. Working on a fix now.

All 4 comments

Hi - The isExpanded prop is designed to set the components initial expanded property. if you want to toggle the value, you can use the exposed on toggle method inside of the nav component. Would this solve your issue? @marshmalien

@ibolton336, the problem we have in OpenShift console is there is no way to expand sections of the nav when changing routes using links in the content (not the nav). For example, if I click the name of a deployment, I am routed to the deployment details page and the workloads nav section is set to active, but the workloads nav section is not expanded to show me the type of workload I am viewing. I have to click workloads to expand it. Seems far from ideal to only allow expansion onToggle of a nav item.

zuq7snrd4r

cc: @janwright73, @spadgett

@rhamilto - Just reopened. Thanks for the additional detail. Working on a fix now.

navexpandfix
screen shot 2019-03-04 at 2 23 43 pm

Was this page helpful?
0 / 5 - 0 ratings