Skip to content

Conversation

@KishanInnovates
Copy link
Contributor

@KishanInnovates KishanInnovates commented Mar 2, 2025

fix: prevent nested <a> tags in MobileNavMenu

Issue Reference

Closes #3766

Changes Made

  • Removed nested <a> tags inside Link components.
  • Ensured accessibility and valid HTML structure.

How to Test

  • Run the project locally.
  • Open the mobile nav menu.
  • Click on different links and verify correct navigation without warnings.

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor
    • Streamlined the mobile navigation menu by removing unnecessary wrapping elements around navigation links.
    • Updated link styling for improved user interaction while maintaining existing functionality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request simplify the structure of the mobile navigation menu. In MobileNavMenu.tsx, the <a> tags surrounding <Link> components have been removed, and the cursor-pointer class has been added directly to the <Link> components. This update streamlines the markup while preserving the existing conditional rendering based on the open state.

Changes

File Path Summary
components/navigation/MobileNavMenu.tsx Removed <a> tags wrapping <Link> components and added cursor-pointer class directly.

Possibly related PRs

Suggested reviewers

  • derberg
  • akshatnema
  • magicmatatjahu
  • sambhavgupta0705
  • asyncapi-bot-eve

Poem

I'm hopping through the lines of code,
Simplifying links on this digital road.
No more extra tags to weigh us down,
Just cursor pointers, light as a crown.
With a wiggle of my ears and a joyful leap,
This streamlined menu makes my heart skip a beat!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6c4c52 and 00007f7.

📒 Files selected for processing (1)
  • components/navigation/MobileNavMenu.tsx (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link

netlify bot commented Mar 2, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 00007f7
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/67cbd8b0602f700008cbbae4
😎 Deploy Preview https://deploy-preview-3775--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
components/navigation/MobileNavMenu.tsx (4)

88-90: Remove Nested <a> Tags for Docs Link
The revised Docs link now directly uses the <Link> component with the cursor-pointer class, effectively eliminating the invalid nesting of <a> tags. This improves both the semantic structure and accessibility of the code. Additionally, please check for any extra spaces as flagged by ESLint and adjust accordingly.

🧰 Tools
🪛 ESLint

[error] 88-88: Delete ··

(prettier/prettier)


[error] 89-89: Delete ··

(prettier/prettier)


[error] 90-90: Delete ··

(prettier/prettier)


98-100: Simplify Tools Link Structure
The Tools section now uses <Link> with the cursor-pointer class instead of wrapping it with an <a> tag. This change ensures valid HTML structure and a more streamlined component markup. Ensure that associated whitespace adheres to the ESLint/prettier guidelines.

🧰 Tools
🪛 ESLint

[error] 99-99: Delete ··

(prettier/prettier)


107-109: Eliminate Redundant <a> Tag in Community Link
By replacing the outer <a> container with a <Link> component directly, the Community link now avoids invalid nested anchors. This change aligns with best practices for accessibility and markup validity. Please verify that the styling (e.g., spacing) remains consistent and consider running a formatter to resolve the minor ESLint whitespace issues.

🧰 Tools
🪛 ESLint

[error] 107-107: Delete ··

(prettier/prettier)


[error] 108-108: Delete ··

(prettier/prettier)


[error] 109-109: Replace ··</Link>·· with </Link>

(prettier/prettier)


[error] 109-109: Trailing spaces not allowed.

(no-trailing-spaces)


117-120: Consider Consistent Navigation Element for 'Others' Section
While the PR’s primary objective was to fix nested <a> tags, note that the 'Others' section still uses a plain <a> element (<a className='cursor-pointer'>Others</a>). If this element is intended to navigate or toggle submenus similar to the other sections, it might be worth considering a refactor to use the <Link> component for consistency.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9687130 and 13dc924.

📒 Files selected for processing (1)
  • components/navigation/MobileNavMenu.tsx (1 hunks)
🧰 Additional context used
🪛 ESLint
components/navigation/MobileNavMenu.tsx

[error] 88-88: Delete ··

(prettier/prettier)


[error] 89-89: Delete ··

(prettier/prettier)


[error] 90-90: Delete ··

(prettier/prettier)


[error] 99-99: Delete ··

(prettier/prettier)


[error] 107-107: Delete ··

(prettier/prettier)


[error] 108-108: Delete ··

(prettier/prettier)


[error] 109-109: Replace ··</Link>·· with </Link>

(prettier/prettier)


[error] 109-109: Trailing spaces not allowed.

(no-trailing-spaces)

⏰ Context from checks skipped due to timeout of 180000ms (4)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website
  • GitHub Check: Lighthouse CI

@KishanInnovates KishanInnovates changed the title Fix: Resolve <a> inside <a> nesting issue in MobileNavMenu fix: resolve <a> inside <a> nesting issue in MobileNavMenu Mar 2, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
components/navigation/MobileNavMenu.tsx (5)

88-90: Great fix for the nested <a> tags issue!

The removal of the unnecessary <a> tag around the Link component is correct, as Next.js Link components already render as <a> elements in the DOM. This change helps maintain valid HTML structure and improves accessibility.

However, there are some formatting issues flagged by the pipeline:

  • Extra spaces at the beginning of lines 88-90
  • Invalid Tailwind CSS classnames order on line 88 (should be flex cursor-pointer instead of cursor-pointer flex)
-              <Link href='/docs' className='cursor-pointer flex'>
+              <Link href='/docs' className='flex cursor-pointer'>
🧰 Tools
🪛 ESLint

[error] 88-88: Delete ··

(prettier/prettier)


[error] 89-89: Delete ··

(prettier/prettier)


[error] 90-90: Delete ··

(prettier/prettier)

🪛 GitHub Actions: PR testing - if Node project

[error] 88-88: Delete ·· prettier/prettier


[warning] 88-88: Invalid Tailwind CSS classnames order tailwindcss/classnames-order


[error] 89-89: Delete ·· prettier/prettier


[error] 90-90: Delete ·· prettier/prettier


98-100: Good fix for nested interactive elements!

Removing the <a> tag wrapper around the Link component fixes the HTML validity issue.

But please fix the formatting issues:

  • Extra spaces at the beginning of line 99
  • Invalid Tailwind CSS classnames order on line 98 (should be flex cursor-pointer instead of cursor-pointer flex)
-              <Link href='/tools' className='cursor-pointer flex'>
-                  Tools
-              </Link>
+              <Link href='/tools' className='flex cursor-pointer'>
+                Tools
+              </Link>
🧰 Tools
🪛 ESLint

[error] 99-99: Delete ··

(prettier/prettier)

🪛 GitHub Actions: PR testing - if Node project

[warning] 98-98: Invalid Tailwind CSS classnames order tailwindcss/classnames-order


[error] 99-99: Delete ·· prettier/prettier


107-109: Clean removal of nested anchor tag!

This change correctly addresses the issue by removing the wrapping <a> tag.

Please fix these formatting issues:

  • Extra spaces at the beginning of lines 107-108
  • Trailing spaces on line 109
  • Invalid Tailwind CSS classnames order on line 107 (should be flex cursor-pointer instead of cursor-pointer flex)
-                <Link href='/community' className='cursor-pointer flex'>
-                  Community
-                </Link>  
+              <Link href='/community' className='flex cursor-pointer'>
+                Community
+              </Link>
🧰 Tools
🪛 ESLint

[error] 107-107: Delete ··

(prettier/prettier)


[error] 108-108: Delete ··

(prettier/prettier)


[error] 109-109: Replace ··</Link>·· with </Link>

(prettier/prettier)


[error] 109-109: Trailing spaces not allowed.

(no-trailing-spaces)

🪛 GitHub Actions: PR testing - if Node project

[error] 107-107: Delete ·· prettier/prettier


[warning] 107-107: Invalid Tailwind CSS classnames order tailwindcss/classnames-order


[error] 108-108: Delete ·· prettier/prettier


[error] 109-109: Replace ··</Link>·· with </Link> prettier/prettier


[error] 109-109: Trailing spaces not allowed. no-trailing-spaces


118-118: Consider updating the "Others" section for consistency

While you've fixed the nested <a> issues in the Docs, Tools, and Community sections, consider applying the same pattern to the "Others" section where there's still a standalone <a> tag.

Since this section also links to items (when expanded), you might want to replace this with a Link component like the other sections for consistency, or just remove the cursor-pointer class if it's not actually clickable.


141-143: Consider updating the "Language" section for consistency

Similar to the "Others" section, the "Language" section uses a standalone <a> tag. For consistency across the mobile navigation menu, consider handling this section in the same way as the other sections.

Since the language dropdown is controlled by the parent div's onClick event rather than the anchor tag's behavior, it would be clearer to just use a <span> or <div> instead of an <a> tag here.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13dc924 and a6c4c52.

📒 Files selected for processing (1)
  • components/navigation/MobileNavMenu.tsx (1 hunks)
🧰 Additional context used
🪛 ESLint
components/navigation/MobileNavMenu.tsx

[error] 88-88: Delete ··

(prettier/prettier)


[error] 89-89: Delete ··

(prettier/prettier)


[error] 90-90: Delete ··

(prettier/prettier)


[error] 99-99: Delete ··

(prettier/prettier)


[error] 107-107: Delete ··

(prettier/prettier)


[error] 108-108: Delete ··

(prettier/prettier)


[error] 109-109: Replace ··</Link>·· with </Link>

(prettier/prettier)


[error] 109-109: Trailing spaces not allowed.

(no-trailing-spaces)

🪛 GitHub Actions: PR testing - if Node project
components/navigation/MobileNavMenu.tsx

[error] 88-88: Delete ·· prettier/prettier


[warning] 88-88: Invalid Tailwind CSS classnames order tailwindcss/classnames-order


[error] 89-89: Delete ·· prettier/prettier


[error] 90-90: Delete ·· prettier/prettier


[warning] 98-98: Invalid Tailwind CSS classnames order tailwindcss/classnames-order


[error] 99-99: Delete ·· prettier/prettier


[error] 107-107: Delete ·· prettier/prettier


[warning] 107-107: Invalid Tailwind CSS classnames order tailwindcss/classnames-order


[error] 108-108: Delete ·· prettier/prettier


[error] 109-109: Replace ··</Link>·· with </Link> prettier/prettier


[error] 109-109: Trailing spaces not allowed. no-trailing-spaces

⏰ Context from checks skipped due to timeout of 180000ms (3)
  • GitHub Check: Redirect rules - asyncapi-website
  • GitHub Check: Header rules - asyncapi-website
  • GitHub Check: Pages changed - asyncapi-website

@codecov
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (71f5d4e) to head (00007f7).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3775   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines          667       667           
  Branches       113       113           
=========================================
  Hits           667       667           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@anshgoyalevil
Copy link
Member

/rtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] <a> cannot appear as a descendant of <a> in MobileNavMenu

3 participants