Skip to content

Conversation

@Nitinn12
Copy link

@Nitinn12 Nitinn12 commented Dec 13, 2025

The PictoPy documentation website had responsiveness issues on smaller screen sizes. On mobile and narrow viewports, content overflowed horizontally, causing important UI elements and text to be partially hidden. This made the documentation difficult to read and navigate.

This PR resolves these issues by improving the responsive layout, ensuring the documentation renders correctly across all screen sizes, including mobile devices.
Changes Made
1.Updated responsive CSS styles
2.Improved layout handling for narrow viewports
3.Ensured consistent spacing and alignment across breakpoints
Screenshot 2025-12-13 170625

Summary by CodeRabbit

  • Documentation

    • Updated API documentation page layout
  • Style

    • Documentation pages now display optimally on mobile and tablet devices
    • Improved text wrapping and content flow to prevent horizontal scrolling
    • Enhanced header and navigation styling across all screen sizes
    • Better typography spacing and readability on smaller viewports
    • Consistent, flexible layout across different device sizes

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

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

Walkthrough

Removed inline JavaScript that enforced a fixed 500px layout constraint on the API page, replacing it with flexible, responsive CSS rules that prevent overflow, enable horizontal scrolling, and improve layout safeguards across the documentation site.

Changes

Cohort / File(s) Summary
API Page Script Removal
docs/backend/backend_python/api.md
Removed DOMContentLoaded JavaScript that conditionally applied the api-fixed-500 CSS class to the body element for layout scoping.
Responsive Layout Overhaul
docs/stylesheets/extra.css
Added global layout safeguards (box-sizing reset, overflow prevention with max-width and overflow-x rules), strengthened header responsiveness (flex-shrink controls, wrapping), enforced text truncation for navigation/typography, introduced .api-500-wrapper for API content containment, normalized grid/container max-widths, expanded responsive typography adjustments across breakpoints, and removed legacy 500px fixed-layout constraints in favor of flexible scrollable design.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay special attention to the .api-500-wrapper implementation and how it interacts with Swagger UI / Redoc components on small viewports
  • Verify that the removal of 500px hard constraints does not break the API documentation rendering across different screen sizes
  • Test horizontal scrolling behavior on mobile devices and ensure no unintended layout shifts occur with the new overflow-x rules
  • Confirm that the extensive CSS additions do not introduce conflicting rules with existing Markdown or theme styles

Possibly related PRs

Suggested labels

documentation, enhancement, UI

Poem

🐰 A rabbit hops through CSS land,
Where 500 pixels once made their stand,
Now overflow and wraps take flight,
Responsive scrolls—oh, what a sight!
Smaller screens can breathe so free,
Layout magic, flexible and spry! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fixed mobile-responsiveness-ui' is partially related to the changeset but lacks clarity and specificity. It uses hyphenated words that read more like a branch name than a descriptive PR title, and 'fixed' is vague without explaining what was fixed. Revise the title to be more descriptive and human-readable, such as 'Improve mobile responsiveness for documentation site' or 'Fix horizontal overflow and layout issues on mobile viewports'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 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.

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

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

🧹 Nitpick comments (3)
docs/stylesheets/extra.css (3)

338-347: Reconsider universal selector on .swagger-ui * with max-width: 100%.

Using a universal selector (.swagger-ui *) to apply max-width: 100% can have unintended cascade effects on deeply nested elements, potentially constraining internal layout components that should not be restricted. This broad rule might conflict with Swagger UI's internal structure and component sizing logic.

Consider scoping the rule more narrowly to specific child elements that actually need the constraint, such as text, code blocks, and tables within Swagger UI.

-.swagger-ui,
-.swagger-ui * {
-  box-sizing: border-box;
-  max-width: 100%;
-}
+.swagger-ui {
+  box-sizing: border-box;
+}
+
+.swagger-ui code,
+.swagger-ui pre,
+.swagger-ui table {
+  box-sizing: border-box;
+  max-width: 100%;
+}

37-43: Verify necessity of !important on .md-header__title.

Line 37 uses !important on margin-left, which is generally a code smell. If the base Material theme or other stylesheets are applying conflicting styles, that's worth investigating. Consider whether the specificity of your selectors is sufficient without !important, or if the issue lies upstream.

If !important is necessary due to unavoidable conflicts in the base theme, add a brief comment explaining why.


176-193: Reduce duplication in heading and text wrapping rules across media queries.

Lines 176–193 in the @media (max-width: 768px) block define heading and paragraph wrapping rules that are partially repeated in the @media (max-width: 480px) block (lines 252–271 with slightly different font sizes). Extract common wrapping properties to a shared rule to reduce duplication and improve maintainability.

+ /* Shared heading and text wrapping for small screens */
+ @media (max-width: 768px) {
+   .md-typeset h1,
+   .md-typeset h2,
+   .md-typeset h3,
+   .md-typeset h4,
+   .md-typeset h5,
+   .md-typeset h6,
+   .md-typeset p,
+   .md-typeset li,
+   .md-typeset blockquote {
+     word-wrap: break-word;
+     overflow-wrap: break-word;
+     max-width: 100%;
+   }
+ }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d07d817 and a4d2388.

📒 Files selected for processing (2)
  • docs/backend/backend_python/api.md (0 hunks)
  • docs/stylesheets/extra.css (5 hunks)
💤 Files with no reviewable changes (1)
  • docs/backend/backend_python/api.md
🔇 Additional comments (3)
docs/stylesheets/extra.css (3)

330-336: Approve .api-500-wrapper responsive container.

The new .api-500-wrapper class replaces the removed fixed 500px layout constraint with a flexible, scrollable container design. This is a solid approach to maintaining backward compatibility while enabling responsive behavior. The inclusion of -webkit-overflow-scrolling: touch; is a good touch for iOS momentum scrolling.


288-324: Approve homepage 4-column responsive layout fix.

The selector targeting inline display:flex styles and the cascading media queries (900px → 50% width, 540px → 100% width) are a pragmatic solution to handle the inline HTML layout in docs/index.md. Using !important is appropriate here since you're overriding inline styles. The responsive stacking is well thought out.


432-469: Approve Swagger UI responsive typography adjustments.

The font-size reductions and method/path styling across breakpoints (768px and 480px) follow a sensible progressive degradation approach. Reducing font sizes on smaller screens and adjusting word-break behavior is appropriate for Swagger UI's typically dense content.

Comment on lines +6 to +15
html {
overflow-x: hidden;
max-width: 100vw;
}

body {
overflow-x: hidden;
max-width: 100vw;
position: relative;
}
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 | 🟠 Major

Reconsider using 100vw on html and body elements.

Using 100vw with overflow-x: hidden can paradoxically cause horizontal overflow issues because 100vw includes the vertical scrollbar width, which varies across browsers and devices. This is a known pitfall that can trigger unwanted horizontal scrolling on some viewports.

Consider using 100% instead, or relying on the default behavior without the explicit max-width constraint on these root elements.

 html {
   overflow-x: hidden;
-  max-width: 100vw;
+  max-width: 100%;
 }
 
 body {
   overflow-x: hidden;
-  max-width: 100vw;
+  max-width: 100%;
   position: relative;
 }
📝 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
html {
overflow-x: hidden;
max-width: 100vw;
}
body {
overflow-x: hidden;
max-width: 100vw;
position: relative;
}
html {
overflow-x: hidden;
max-width: 100%;
}
body {
overflow-x: hidden;
max-width: 100%;
position: relative;
}
🤖 Prompt for AI Agents
In docs/stylesheets/extra.css around lines 6 to 15, using max-width: 100vw on
html and body combined with overflow-x: hidden can cause horizontal overflow
because 100vw includes the scrollbar width; replace max-width: 100vw with
max-width: 100% (or remove the explicit max-width entirely) to rely on the
natural layout, and keep overflow-x: hidden only if you still need to forcibly
hide horizontal overflow.

Comment on lines 134 to +141
/* Allow header inner area to wrap so items don't overflow */
.md-header__inner {
flex-wrap: wrap;
flex-wrap: nowrap;
align-items: center;
gap: 6px;
overflow: hidden;
max-width: 100%;
}
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 | 🔴 Critical

Fix contradictory flex-wrap value in comment.

Line 134's comment states "Allow header inner area to wrap," but line 136 explicitly sets flex-wrap: nowrap;. This contradiction suggests either the comment or the code is incorrect and may lead to unintended layout behavior.

If the intent is to allow wrapping, change nowrap to wrap. If the intent is to prevent wrapping, update the comment to reflect that.

   /* Allow header inner area to wrap so items don't overflow */
   .md-header__inner {
-    flex-wrap: nowrap;
+    flex-wrap: wrap;
     align-items: center;
     gap: 6px;
     overflow: hidden;
     max-width: 100%;
   }
🤖 Prompt for AI Agents
In docs/stylesheets/extra.css around lines 134 to 141, the comment says "Allow
header inner area to wrap" but the rule sets flex-wrap: nowrap; — reconcile the
contradiction by either changing the CSS to flex-wrap: wrap; if the header
should be allowed to wrap (and verify overflow/max-width behave as intended), or
update the comment to accurately state that wrapping is prevented (e.g.,
"Prevent header inner area from wrapping") if nowrap is the intended behavior.

@rahulharpal1603
Copy link
Contributor

@Nitinn12 Please link the corresponding issue to this PR.

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.

2 participants