-
Notifications
You must be signed in to change notification settings - Fork 538
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
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 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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 |
|
Closes https://github.com/github/primer/issues/2512
This adds the
defaultOpen
prop 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-current
in 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:
defaultOpen
to follow a similar pattern to TreeView'sdefaultExpanded
. We're wondering if it'd be a little more accurate to name it something likeinitiallyOpen
,defaultToOpen
oropenOnStart
.defaultOpen
on 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
defaultOpen
is 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.