Uh oh!
There was an error while loading. Please reload this page.
NavList add defaultOpen to NavList.Item - #3698
Conversation
🦋 Changeset detectedLatest commit: ad2a14f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
siddharthkp
commented
Sep 6, 2023
You're completely right, but because the HTML API has keys like To keep the API familiar, we have kept the same convention for props that set the initial value in primer/react as well |
|
Closeshttps://github.com/github/primer/issues/2512
This adds the
defaultOpenprop to NavList.Item. We needed this because in the Docs sidebar needs the ability to have a NavList.SubNav default to open even without anaria-currentin its nested levels like so:Another pro is that this essentially resolves depending on client-side rendering of our sidebar.
A few notes about my changes:
defaultOpento follow a similar pattern to TreeView'sdefaultExpanded. We're wondering if it'd be a little more accurate to name it something likeinitiallyOpen,defaultToOpenoropenOnStart.defaultOpenon a NavList.Item without a NavList.SubNav. I was thinking it could throw an error instead, but I noticed below other checks like depth were usingconsole.error, so I did the same.Thank you for the review, and please let me know if there are any questions or concerns!
Screenshots
No real visual difference unless a
defaultOpenis added to a NavList.Item with a NavList.SubNav. That is shown above in the changes I described.Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.