Skip to content

Conversation

@jameshaworthcs
Copy link
Contributor

@jameshaworthcs jameshaworthcs commented Jun 9, 2025

Fixes #21, where the viewport on iOS Safari would remain zoomed in after a user sends a message, requiring them to manually zoom out.

The fix implements maximum-scale=1 in the viewport export in app/layout.tsx. This prevents the browser from scaling the viewport when the chat input is focused, ensuring a consistent and user-friendly experience on mobile devices.

This approach was adopted after several other methods, including css changes, failed to produce the desired behavior.

Result:
30262

Change tested to not affect user experience on other devices.

Summary by CodeRabbit

  • New Features
    • Improved viewport settings to enhance display scaling behavior.

On iOS devices, the browser automatically zooms in on text inputs, which can disrupt the user experience by leaving the viewport zoomed in after an action is completed.

This change resolves the issue by setting `maximum-scale=1` in the viewport configuration, preventing both automatic and manual scaling and ensuring the chat interface remains fully visible after sending a message.

Fixes senbo1#21
@vercel
Copy link

vercel bot commented Jun 9, 2025

@jameshaworthcs is attempting to deploy a commit to the Harsh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Jun 9, 2025

Walkthrough

A new export named viewport of type Viewport was added to the application layout file. This export sets the maximumScale property to 1, restricting the maximum zoom level for the application's viewport. No other logic or structural changes were introduced.

Changes

File(s) Change Summary
app/layout.tsx Added import of Viewport type; exported new viewport constant with maximumScale: 1.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant AppLayout

    Browser->>AppLayout: Load layout.tsx
    AppLayout-->>Browser: Export viewport config (maximumScale: 1)
    Browser-->>Browser: Apply viewport restriction
Loading

Possibly related issues

Poem

A tweak to the viewport, so small yet so neat,
No more wild zooming when browsing the suite.
With maximumScale set, the view stays just right—
A hop and a skip, your UI’s in sight!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

app/layout.tsx

Oops! Something went wrong! :(

ESLint: 9.28.0

ESLint couldn't find the plugin "eslint-plugin-react-hooks".

(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react-hooks@latest --save-dev

The plugin "eslint-plugin-react-hooks" was referenced from the config file in " » eslint-config-next/core-web-vitals » /node_modules/.pnpm/eslint-config-next@15.3.2_eslint@9.28.0_jiti@2.4.2__typescript@5.8.3/node_modules/eslint-config-next/index.js".

If you still can't figure out the problem, please see https://eslint.org/docs/latest/use/troubleshooting.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

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 40ab5f6 and 9c67809.

📒 Files selected for processing (1)
  • app/layout.tsx (2 hunks)
🔇 Additional comments (1)
app/layout.tsx (1)

1-1: Approve import addition
The Viewport type is correctly imported as a type from 'next'.

Comment on lines +24 to +26
export const viewport: Viewport = {
maximumScale: 1,
};
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Accessibility and compatibility check for maximumScale
Disabling zoom via maximumScale: 1 might conflict with accessibility best practices (WCAG) and could impede users who rely on zoom. Moreover, confirm that your Next.js version supports the standalone export const viewport API—if not, you may need to include viewport settings within the metadata object or upgrade Next.js.

Please verify compliance with both accessibility guidelines and Next.js support for this feature.


🏁 Script executed:

#!/bin/bash
echo "Next.js version(s) in package.json:"
cat package.json | jq '.dependencies.next, .devDependencies.next'
echo
echo "Occurrences of `export const viewport` in the codebase:"
rg -n "export const viewport"
echo
echo "Occurrences of `export const metadata` in the codebase:"
rg -n "export const metadata"

Length of output: 550


Allow user zoom for accessibility; Next.js standalone viewport export is supported

  • According to WCAG 2.1 (Success Criterion 1.4.4), disabling or severely restricting zoom (e.g. maximumScale: 1) can block users from resizing text up to 200%. To comply, remove the maximumScale setting (or set it to at least 5) so pinch-to-zoom remains available.
  • You’re on Next.js 15.3.2, which already supports a top-level export const viewport in the App Router—no need to move it into metadata.

Suggested change:

 export const viewport: Viewport = {
-  maximumScale: 1,
+  // allow user zoom by omitting maximumScale (or set ≥5 if needed)
 };
📝 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
export const viewport: Viewport = {
maximumScale: 1,
};
export const viewport: Viewport = {
// allow user zoom by omitting maximumScale (or set ≥5 if needed)
};
🤖 Prompt for AI Agents
In app/layout.tsx around lines 24 to 26, the viewport export disables user zoom
by setting maximumScale to 1, which conflicts with accessibility guidelines. To
fix this, remove the maximumScale property or set it to a higher value (e.g., 5)
to allow pinch-to-zoom. Since Next.js 15.3.2 supports the standalone export
const viewport, keep it at the top level without moving it into metadata.

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.

Bug: Viewport remains zoomed in after chat input on mobile Safari

1 participant