carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.82k stars 1.8k forks source link

[Feature Request]: Expand all prop for the SideNavMenu #9604

Closed adamalston closed 2 years ago

adamalston commented 3 years ago

Summary

Add an expand all (expandAll?) prop for the SideNavMenu to expand all of the menus in the SideNav.

Justification

A design document that my team was given has a button to toggle the expansion of all items in the SideNavMenu.

I can currently expand all menus in the SideNav using the following code but it is just a "hack" to show that it is possible:

<S.SideNavMenu
  ref={(el: HTMLButtonElement) => {
    el?.setAttribute('aria-expanded', 'true');
  }}
  ...
>

Having a set property to accomplish this task would be much better.

Desired UX and success metrics

A user would click a button located in the SideNav which would toggle the expansion of all menus.

Required functionality

No response

Specific timeline issues / requests

No response

Available extra resources

No response

Code of Conduct

jnm2377 commented 2 years ago

@adamalston thanks for opening this issue. We are thinking we don't really want to support this, but also want to understand your reasons behind wanting this. Could you explain why this is needed?

adamalston commented 2 years ago

Essentially what the issue description says; we have a design doc with a button to expand all SideNavMenu items. I would like a streamlined way of invoking this functionality (via a prop) but if that's not an option, we can just use the hack I have in the description.

jnm2377 commented 2 years ago

@adamalston what I was trying to ask was why is this UX pattern useful or important to have? What problem is it solving? What research has been done for it? I think just having a design spec for it is not always a good enough reason, we have to consider the reasoning behind it. Can your design team provide more information? 🙂

adamalston commented 2 years ago

Heard back from one of the designers working with my team:

We can skip it since carbon doesnt seem to support it. That design was based from carbon’s take on left nav, but if they don’t have future plans to do so, we can go ahead and skip it

Closing.

scottagt commented 1 year ago

I have to say, I just found myself in a similar situation to the original poster and needed to expand a sideNavMenu to notify the user of incoming chat messages in their list of chats and I was surprised to find there was no "expanded" property that could be used to control the open/close of the menu. I was further surprised that the original poster was asked to jump through hoops to justify their request. 🤷‍♂️ @adamalston Thank you very much for the hack.