-
Notifications
You must be signed in to change notification settings - Fork 641
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
[Redesign] Fix registration's link to the README #8699
Conversation
I think the expander section works generically with: NuGetGallery/src/NuGetGallery/Scripts/gallery/common.js Lines 230 to 233 in dab8259
Would it make sense to do something similar for tabs? |
@joelverhagen Nice catch, I didn't realize we had implemented that URL functionality.
This would be useful, but this particular fix wouldn't use that general/shared logic. The URL fragment to open the README, I'd suggest we punt the generic logic until we have a scenarios that would use this logic. Let me know if you feel otherwise @joelverhagen . |
@@ -494,14 +494,25 @@ | |||
<ul class="nav nav-tabs" role="tablist"> | |||
@if (!Model.Deleted) | |||
{ | |||
<li role="presentation" class="active"><a href="#readme-tab" aria-controls="ReadMe" role="tab" data-toggle="tab" id="readme-body-tab" class="body-tab">README</a></li> | |||
<li role="presentation"><a href="#dependencies-tab" aria-controls="Dependencies" role="tab" data-toggle="tab" id="dependencies-body-tab" class="body-tab">Dependencies</a></li> | |||
<li role="presentation" class="active" id="show-readme-container"> |
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.
I am not very sure. Do we need the id here?
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.
Yup, as the browser will move down the page to the element with the show-readme-container
ID when I have the URL fragment #show-readme-container
. (The .focus()
in javascript does not do that, it simply highlights the element)
Background
For packages with an embedded readme, registration's
readmeUrl
links to the display package page using the#show-readme-container
URL fragment. For example: https://api.nuget.org/v3/registration5-gz-semver2/knapcode.torsharp/index.json:Example registration JSON for package with embedded readme...
Fix
In the current design, this is implemented using Bootstrap 3's collapse component. The redesign broke this feature as it uses Bootstrap 3's tab component instead, which does not support opening using fragments. This change re-adds support for the
#show-readme-container
fragment link using Javascript.I also fixed some ARIA attributes to improve accessibility.
Addresses #8698