Bug: Fixed “Go to Project” button not working#546
Bug: Fixed “Go to Project” button not working#546hc-codes wants to merge 1 commit intofirstcontributions:mainfrom
Conversation
|
@Roshanjossey please review this PR, Fixed the Go to project button not working scenario when open issues are there in the card. |
Esh07
left a comment
There was a problem hiding this comment.
You do not need to create another <a> tag to wrap <span> tag.
The main issue is that when loadIssues evaluates to true, it renders a component containing another <a> tag. Since nested links are invalid HTML, this breaks the link structure.
src/components/ProjectCard.astro
Outdated
| @@ -41,14 +41,16 @@ const { projectLink, logoLink, name, description, tags = [], loadIssues = false | |||
| <IssueList projectLink={projectLink} projectName={name} /> | |||
| )} | |||
| </div> | |||
| <div class="Card-Link"> | |||
| <span>Go to Project</span> | |||
| </div> | |||
| </a> | |||
| <a class="Card-Link" href={projectLink} target="_blank"> | |||
There was a problem hiding this comment.
You do not need to create another <a> tag to wrap <span> tag.
The main issue is that when loadIssues evaluates to true, it renders a component containing another <a> tag. Since nested links are invalid HTML, this breaks the link structure.
Here is affected code
<div class="Card-Container">
<a class="Card-Real-Link" href={projectLink} target="_blank">
<div class="Card-Header">
//. ......
</div>
<div class="Card-Body">
{loadIssues && ( // <----- when it's `loadIssues` evaluates true, it renders another list
<IssueList projectLink={projectLink} projectName={name} />
// |
// |--> ## <IssueList /> container below code
//========---- <IssueList /> component code ---======
<div class="Card-Issues">
// ......
{issues.length > 0 ? (
<div class="Issues-List">
{issues.map((issue) => (
/**-------XXXXXX <a> become child of parent <a> ----------------------------
* (it applies link to below list but it breaks hyperlinks after </a> // |
**/ // |
<a href={issue.html_url} target="_blank" class="Issue-Card"> // |
// ..... // |
<div class="Issue-Content"> // |
// ....... // |
</div> // |
<div class="Issue-Labels"> // |
// .... // |
</div> // |
</a> // |
// ----------------------------------------------------------------------------------------
)}
</div>
// ........
)}
</div>
//========---- End of <IssueList /> component code ---======
</div>
// Since this renders after second `<a>` tag, it breaks the link even though it is still warped under the parent `<a>` tag.
<div class="Card-Link">
<span>Go to Project</span>
</div>
</a>
</div>
| --- | ||
|
|
||
| <div class="Card-Container"> | ||
| <a class="Card-Real-Link" href={projectLink} target="_blank"> |
| <IssueList projectLink={projectLink} projectName={name} /> | ||
| )} | ||
| <div class="Card-Link"> | ||
| <a href={projectLink} target="_blank"> |
There was a problem hiding this comment.
Now this has become a child of <a>. The issue remains the same - we cannot nest <a> inside another </a>.
Fixes: #535