Skip to content

Comments

fix: improve mobile UX for Specification Explorer with content-first layout and toggle#5107

Open
Sourya07 wants to merge 9 commits intoasyncapi:masterfrom
Sourya07:fix/specification
Open

fix: improve mobile UX for Specification Explorer with content-first layout and toggle#5107
Sourya07 wants to merge 9 commits intoasyncapi:masterfrom
Sourya07:fix/specification

Conversation

@Sourya07
Copy link
Contributor

@Sourya07 Sourya07 commented Feb 8, 2026

Description
fixes the issue for the Specification Explorer
->#4757
by making changes in the ->

  1. styles/globals.css
  2. components/docs/Visualizer.tsx
  3. components/layout/DocsLayout.tsx

Related issue(s)

Summary by CodeRabbit

  • New Features

    • Added a mobile toggle to show/hide the visual map on small screens
    • Mobile-first behavior: map remains hidden by default and can be revealed via the toggle
  • Style

    • Improved responsive layout and element visibility across viewport sizes
    • Better text wrapping and horizontal scrolling for code/content panels
    • Adjusted menu button visibility for small vs. medium+ screens

@netlify
Copy link

netlify bot commented Feb 8, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 517a79b
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/69884df0b149880008329baf
😎 Deploy Preview https://deploy-preview-5107--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 project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

Adds a mobile-toggle to the Visualizer for showing/hiding the visual map, responsive CSS media queries to adjust visualizer layout on small screens, and hides the DocsLayout Menu button on small viewports; no configuration semantics or exported APIs changed.

Changes

Cohort / File(s) Summary
Configuration
\.coderabbit\.yaml
No semantic change; only a non-functional line edit in pull_requests.scope.
Visualizer & Layout
components/docs/Visualizer.tsx, components/layout/DocsLayout.tsx
Visualizer: adds useState and a mobile toggle button that toggles a show-map class to control map visibility. DocsLayout: adds hidden md:block to Menu container to change small-screen visibility.
Styling
styles/globals.css
Adds responsive rules: @media (max-width:768px) rearranges .visualizer-container to column layout, hides .node-container by default and shows it when .show-map is present, adjusts panel sizing/overflow and text wrapping; @media (min-width:769px) hides .mobile-toggle.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A little toggle, click and glide,
Maps curl up or stretch open wide,
CSS hops to fit each screen,
Buttons hide where small is seen,
I nibble bugs and dance with pride.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: improving mobile UX for the Specification Explorer with a content-first layout and toggle feature, which aligns with all file modifications across styling, component state, and responsive behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (581b703) to head (517a79b).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #5107   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          796       796           
  Branches       146       146           
=========================================
  Hits           796       796           

☔ 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.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Feb 8, 2026

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 37
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-5107--asyncapi-website.netlify.app/

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: 2

Caution

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

⚠️ Outside diff range comments (1)
components/layout/DocsLayout.tsx (1)

100-114: ⚠️ Potential issue | 🟠 Major

Hiding the Menu button removes sidebar navigation access on mobile.

hidden md:block completely removes the only way to open the explorer sidebar on small screens. The new Show Visual Map toggle in Visualizer.tsx controls the node-container visibility, not the sidebar navigation. Mobile users lose the ability to navigate between spec sections.

Consider replacing hidden with a mobile-friendly alternative (e.g., a collapsible menu or incorporating a sidebar trigger into the mobile toggle area) rather than removing it entirely.

🤖 Fix all issues with AI agents
In `@components/docs/Visualizer.tsx`:
- Around line 19-26: The wrapper div uses class "mobile-toggle" which is hidden
by a custom CSS breakpoint at min-width:769px, while the button inside also has
Tailwind's md:hidden (min-width:768px), causing a mismatch at 768px; to fix,
remove the Tailwind breakpoint class md:hidden from the button element in
Visualizer.tsx (the button that toggles setShowMap using showMap) so visibility
is controlled solely by the .mobile-toggle rule in styles/globals.css, or
alternatively remove/adjust the .mobile-toggle rule to match Tailwind's md
breakpoint—pick one approach and make both use the same breakpoint.

In `@styles/globals.css`:
- Around line 359-368: The .visualizer-container .node-container rule uses
width: 125% which causes horizontal overflow despite transform: scale(0.8);
change the layout to avoid overflow by setting width: 100% on
.visualizer-container .node-container (or a more appropriate max-width) and rely
on transform: scale(...) for visual shrinkage, or alternatively wrap
.node-container in a parent with overflow: hidden and keep width as-is; update
the CSS rule for .visualizer-container .node-container (and any container markup
if adding a wrapper) to prevent horizontal scrollbars while preserving the
visual scale and transform-origin: top left.
🧹 Nitpick comments (2)
components/layout/DocsLayout.tsx (1)

105-110: Simplify the toggle.

if/else that sets a boolean to true/false is equivalent to toggling.

Proposed fix
             onClick={() => {
-              if (explorerDocMenu) {
-                setExplorerDocMenu(false);
-              } else {
-                setExplorerDocMenu(true);
-              }
+              setExplorerDocMenu((prev) => !prev);
             }}
styles/globals.css (1)

350-401: Heavy !important usage — consider scoping or specificity instead.

Nearly every declaration uses !important, likely to override Schyma's inline styles. This is understandable but fragile — any future Schyma update or refactor could break these overrides silently. If Schyma applies inline styles, !important may be the only option, but it's worth documenting that dependency (a brief comment above the media query would suffice).

Also, the mobile breakpoint at 768px and the desktop breakpoint at 769px don't align with Tailwind's md breakpoint (min-width: 768px). Consider using 767px / 768px to match Tailwind conventions, or stick entirely to Tailwind utilities.

@Sourya07 Sourya07 changed the title fix:Improve mobile UX for Specification Explorer with content-first layout and toggle fix: Improve mobile UX for Specification Explorer with content-first layout and toggle Feb 8, 2026
@Sourya07 Sourya07 changed the title fix: Improve mobile UX for Specification Explorer with content-first layout and toggle fix: improve mobile UX for Specification Explorer with content-first layout and toggle Feb 8, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 8, 2026

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

🤖 Fix all issues with AI agents
In `@components/docs/Visualizer.tsx`:
- Around line 14-26: The toggle button in the Visualizer component should expose
its expanded state to assistive tech: update the button (the one using
onClick={() => setShowMap(!showMap)} in Visualizer) to include
aria-expanded={showMap} (and optionally aria-controls referencing the visual map
container's id) so screen readers can announce whether the visual map is shown;
keep the existing setShowMap and showMap logic unchanged.
🧹 Nitpick comments (1)
components/docs/Visualizer.tsx (1)

4-4: Unnecessary React default import.

With React 18's automatic JSX transform, the React default import is not needed — only { useState } is required. Minor nit, no functional impact.

Suggested tweak
-import React, { useState } from 'react';
+import { useState } from 'react';

Comment on lines 14 to +26
function Visualizer() {
const [showMap, setShowMap] = useState(false);

return (
<div>
<div className={`visualizer-container ${showMap ? 'show-map' : ''}`}>
<div className='mobile-toggle px-4'>
<button
onClick={() => setShowMap(!showMap)}
className='bg-primary-500 hover:bg-primary-600 text-white font-bold py-2 px-4 rounded mb-2 mt-4 w-full'
>
{showMap ? 'Hide Visual Map' : 'Show Visual Map'}
</button>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add aria-expanded to the toggle button for accessibility.

The toggle controls visibility of the visual map but lacks aria-expanded, which screen readers rely on to convey the current state. Given the PR's Lighthouse accessibility score of 98, this small addition would help maintain that standard.

♿ Proposed fix
         <button
+          aria-expanded={showMap}
           onClick={() => setShowMap(!showMap)}
           className='bg-primary-500 hover:bg-primary-600 text-white font-bold py-2 px-4 rounded mb-2 mt-4 w-full'
         >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function Visualizer() {
const [showMap, setShowMap] = useState(false);
return (
<div>
<div className={`visualizer-container ${showMap ? 'show-map' : ''}`}>
<div className='mobile-toggle px-4'>
<button
onClick={() => setShowMap(!showMap)}
className='bg-primary-500 hover:bg-primary-600 text-white font-bold py-2 px-4 rounded mb-2 mt-4 w-full'
>
{showMap ? 'Hide Visual Map' : 'Show Visual Map'}
</button>
</div>
function Visualizer() {
const [showMap, setShowMap] = useState(false);
return (
<div className={`visualizer-container ${showMap ? 'show-map' : ''}`}>
<div className='mobile-toggle px-4'>
<button
aria-expanded={showMap}
onClick={() => setShowMap(!showMap)}
className='bg-primary-500 hover:bg-primary-600 text-white font-bold py-2 px-4 rounded mb-2 mt-4 w-full'
>
{showMap ? 'Hide Visual Map' : 'Show Visual Map'}
</button>
</div>
🤖 Prompt for AI Agents
In `@components/docs/Visualizer.tsx` around lines 14 - 26, The toggle button in
the Visualizer component should expose its expanded state to assistive tech:
update the button (the one using onClick={() => setShowMap(!showMap)} in
Visualizer) to include aria-expanded={showMap} (and optionally aria-controls
referencing the visual map container's id) so screen readers can announce
whether the visual map is shown; keep the existing setShowMap and showMap logic
unchanged.

@Sourya07
Copy link
Contributor Author

Sourya07 commented Feb 8, 2026

@princerajpoot20 please take a look 👍.

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

Labels

None yet

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

3 participants