Skip to content

Conversation

@akhun-web3
Copy link
Collaborator

@akhun-web3 akhun-web3 commented Dec 12, 2025

Overview: This change introduces small but impactful accessibility improvements to the root layout.

Changes

  • Added a <main> landmark role to semantically mark the primary content area in src/app/layout.tsx.
  • Ensures better navigation for assistive technologies, improving overall user experience.

Summary by CodeRabbit

  • Style
    • Improved semantic HTML by adding and standardizing container elements (main) to better organize content and hierarchy.
  • Refactor
    • Simplified top-level layout and composition by removing redundant wrappers and sidebar from the layout hierarchy and adjusting inner container tags—behavior and public interfaces unchanged.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 12, 2025

Walkthrough

Root and general layout files updated to change wrapper elements: the root layout now places children inside a semantic <main> within the existing ErrorBoundary; the (general) app layout removes outer html/body and AppSidebar, and main wrappers were replaced with div elements.

Changes

Cohort / File(s) Summary
Root layout
src/app/layout.tsx
Wrapped RootLayout children in a semantic <main> element inside the existing ErrorBoundary (preserves render order and error handling).
General app layout
src/app/(general)/layout.tsx
Removed outer html/body wrappers and suppressHydrationWarning; removed AppSidebar from the layout hierarchy; replaced inner <main className='w-full'> with <div className='w-full'>; SidebarProvider and LoadingProvider retained at top-level.
GeneralLayout component
src/components/layouts/GeneralLayout.tsx
Swapped wrapper element from <main> to <div> while preserving className and props (no exported API changes).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Pay attention to:
    • Accessibility: replacing main with div and removal of AppSidebar may affect landmark semantics and skip links.
    • Layout/CSS: spacing or global selectors targeting main may need verification.
    • Hydration/server-rendering: removal of suppressHydrationWarning and HTML/body wrappers — confirm no SSR hydration regressions.
    • Provider placement: ensure SidebarProvider/LoadingProvider still provide expected context to children.

Possibly related PRs

Suggested reviewers

  • fehranbit
  • Stereco-btc

Poem

🐇 In burrows of JSX I softly tread,
Swapping mains for divs and moving threads,
ErrorBoundary guards the root so true,
Sidebar hops away — but skies stay blue,
A carrot-code cheer for layouts anew 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding semantic accessibility improvements (a element) to the root layout to enhance navigation for assistive technologies.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/a11y-root-layout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa443ec and 80aff98.

📒 Files selected for processing (1)
  • src/app/layout.tsx (1 hunks)

Comment on lines 19 to 24
<ErrorBoundary>
{children}
<main>
{children}
</main>
<ToastProvider />
</ErrorBoundary>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat -n src/app/layout.tsx

Repository: Authormaton/authormaton

Length of output: 898


🏁 Script executed:

rg -n '<main\b' --type=tsx --type=ts --type=jsx --type=js .

Repository: Authormaton/authormaton

Length of output: 94


🏁 Script executed:

rg -i 'skip.*content|skiplink|skip-link' --type=tsx --type=ts --type=jsx --type=js .

Repository: Authormaton/authormaton

Length of output: 94


🏁 Script executed:

rg -n '<main' . --glob='*.{tsx,ts,jsx,js}'

Repository: Authormaton/authormaton

Length of output: 375


🏁 Script executed:

find src/app -name '*.tsx' -o -name '*.ts' | head -20

Repository: Authormaton/authormaton

Length of output: 292


🏁 Script executed:

rg -i 'skip' src/ --type=jsx --type=js -C 2

Repository: Authormaton/authormaton

Length of output: 94


🏁 Script executed:

cat -n src/app/\(general\)/layout.tsx

Repository: Authormaton/authormaton

Length of output: 945


🏁 Script executed:

cat -n src/components/layouts/GeneralLayout.tsx | head -40

Repository: Authormaton/authormaton

Length of output: 1641


🏁 Script executed:

cat -n src/components/ui/sidebar.tsx | sed -n '280,290p'

Repository: Authormaton/authormaton

Length of output: 603


🏁 Script executed:

git ls-files src/app | grep -E 'layout|page' | sort

Repository: Authormaton/authormaton

Length of output: 262


🏁 Script executed:

cat -n src/app/\(general\)/layout.tsx | grep -A 5 -B 5 'html\|body'

Repository: Authormaton/authormaton

Length of output: 728


Critical issue confirmed: Multiple nested <main> elements exist in the codebase.

Your concern about nested <main> landmarks is valid and needs immediate attention. The current structure creates three levels of <main> elements for routes under (general):

  1. Root layout (src/app/layout.tsx, line 20): <main>
  2. General route group layout (src/app/(general)/layout.tsx, line 13): <main> (nested)
  3. GeneralLayout component (src/components/layouts/GeneralLayout.tsx, line 32): <main> (doubly nested)

This violates HTML semantics—only one <main> landmark should exist per document. Additionally, src/app/(general)/layout.tsx should not re-declare <html> and <body> tags; these belong only in the root layout.

Remove the redundant <main> from the (general) layout and the GeneralLayout component, keeping only the root layout's <main>.

🤖 Prompt for AI Agents
In src/app/layout.tsx around lines 19-24 keep the single root <main> as the
document's only main landmark; remove the redundant <main> elements from
src/app/(general)/layout.tsx (remove any <main> wrapper and ensure it does not
re-declare <html> or <body>) and from src/components/layouts/GeneralLayout.tsx
(replace its <main> with a <div> or fragment), updating imports/props as needed
so children still render in the root <main> without changing semantics.

Copy link

@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: 1

🧹 Nitpick comments (2)
src/app/(general)/layout.tsx (2)

7-7: Rename function to avoid confusion.

The function is named RootLayout but resides in a route group ((general)/layout.tsx), making it a nested layout rather than the actual root layout. This naming could mislead developers.

Consider renaming to better reflect its purpose:

-export default async function RootLayout({ children }: { children: React.ReactNode }) {
+export default async function GeneralRootLayout({ children }: { children: React.ReactNode }) {

11-15: Consider adding ARIA landmark role for better accessibility.

Since the PR focuses on accessibility improvements and this container div holds the main content area, adding an appropriate ARIA role would further enhance navigation for assistive technologies. However, verify that the actual root layout (src/app/layout.tsx) provides the <main> element first to avoid conflicts.

If the root layout does NOT provide a <main> wrapper, consider:

-      <div className='w-full'>
+      <div className='w-full' role='main'>

Otherwise, the current implementation is acceptable as long as the semantic <main> is properly placed at the root level.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80aff98 and 420b569.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • src/app/(general)/layout.tsx (1 hunks)
  • src/components/layouts/GeneralLayout.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/app/(general)/layout.tsx (3)
src/components/common/Sidebar/AppSidebar.tsx (1)
  • AppSidebar (8-45)
src/contexts/LoadingContext.tsx (1)
  • LoadingProvider (12-21)
src/components/layouts/GeneralLayout.tsx (1)
  • GeneralLayout (8-36)
🔇 Additional comments (1)
src/components/layouts/GeneralLayout.tsx (1)

32-32: The change is sound and properly supported by the root layout.

The root layout (src/app/layout.tsx) correctly wraps children in a <main> element at line 20, confirming that the change from <main> to <div> in GeneralLayout.tsx aligns with the PR objective to centralize the <main> landmark at the root level. This prevents duplicate <main> elements and maintains proper semantic HTML structure.

Copy link

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/(general)/layout.tsx (1)

1-1: Remove unused import.

The AppSidebar import is no longer used after correctly removing the duplicate sidebar render (as noted in the past review comment). Clean up by removing this import.

Apply this diff:

-import { AppSidebar } from '@/components/common/Sidebar/AppSidebar';
 import { GeneralLayout } from '@/components/layouts/GeneralLayout';
🧹 Nitpick comments (1)
src/app/(general)/layout.tsx (1)

7-7: Consider renaming for clarity.

The function is named RootLayout but this file is located at src/app/(general)/layout.tsx, which is a route-group layout, not the application root layout. Consider renaming to GeneralGroupLayout or similar to avoid confusion.

Apply this diff:

-export default async function RootLayout({ children }: { children: React.ReactNode }) {
+export default async function GeneralGroupLayout({ children }: { children: React.ReactNode }) {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 420b569 and 972f8b1.

📒 Files selected for processing (1)
  • src/app/(general)/layout.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/app/(general)/layout.tsx (3)
src/components/ui/sidebar.tsx (1)
  • SidebarProvider (672-672)
src/contexts/LoadingContext.tsx (1)
  • LoadingProvider (12-21)
src/components/layouts/GeneralLayout.tsx (1)
  • GeneralLayout (8-36)
🔇 Additional comments (1)
src/app/(general)/layout.tsx (1)

9-15: Structure correctly addresses duplication issue.

The removal of <AppSidebar /> correctly resolves the duplication flagged in the past review comment, as GeneralLayout already handles conditional sidebar rendering for both mobile and desktop. The use of <div> instead of <main> is appropriate here since the root layout (src/app/layout.tsx) now provides the semantic <main> landmark, and nested <main> elements would violate HTML semantics.

@fehranbit fehranbit merged commit 0d86a12 into main Dec 12, 2025
1 of 2 checks passed
@fehranbit fehranbit deleted the fix/a11y-root-layout branch December 12, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants