-
-
Notifications
You must be signed in to change notification settings - Fork 6
fix(mobile): Enable scrolling on mobile and improve layout #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -82,10 +82,15 @@ | |||||||||||||||||||
|
|
||||||||||||||||||||
| /* Mobile layout specific styles */ | ||||||||||||||||||||
| @media (max-width: 1024px) { | ||||||||||||||||||||
| body { | ||||||||||||||||||||
| overflow: auto; | ||||||||||||||||||||
| height: auto; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+85
to
+88
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Mobile body scroll: consider scroll chaining control. Enabling body scroll fixes the issue, but can cause nested-scroll bounce on iOS. Add Apply: body {
overflow: auto;
height: auto;
+ overscroll-behavior-y: contain;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| .mobile-layout-container { | ||||||||||||||||||||
| display: flex; | ||||||||||||||||||||
| flex-direction: column; | ||||||||||||||||||||
| height: 100vh; | ||||||||||||||||||||
| min-height: 100vh; | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use dynamic viewport units to avoid 100vh bugs under mobile browser UI. Prefer 100dvh with 100vh fallback to keep the input reachable when the URL bar collapses/expands. - min-height: 100vh;
+ /* Fallback then dynamic viewport for mobile */
+ min-height: 100vh;
+ min-height: 100dvh;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| width: 100%; | ||||||||||||||||||||
| background-color: hsl(var(--background)); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| $ next dev |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||||||
| from playwright.sync_api import sync_playwright, expect | ||||||||||||||||
|
|
||||||||||||||||
|
Comment on lines
+1
to
+2
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add missing imports used by error handling and env-based selector. from playwright.sync_api import sync_playwright, expect
+import os
+import sys
+import traceback📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| def run(playwright): | ||||||||||||||||
| browser = playwright.chromium.launch(headless=True) | ||||||||||||||||
| context = browser.new_context( | ||||||||||||||||
| viewport={'width': 375, 'height': 667}, | ||||||||||||||||
| is_mobile=True, | ||||||||||||||||
| user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1' | ||||||||||||||||
| ) | ||||||||||||||||
|
Comment on lines
+5
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Use a built‑in mobile device profile (or add has_touch/device scale). Built‑ins ensure consistent emulation (UA, viewport, deviceScaleFactor, hasTouch, etc.). - context = browser.new_context(
- viewport={'width': 375, 'height': 667},
- is_mobile=True,
- user_agent='Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
- )
+ iphone = playwright.devices["iPhone 12"]
+ context = browser.new_context(**iphone)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| page = context.new_page() | ||||||||||||||||
|
|
||||||||||||||||
| try: | ||||||||||||||||
| page.goto("http://localhost:3000") | ||||||||||||||||
|
|
||||||||||||||||
| # Wait for the page to load by looking for a known element | ||||||||||||||||
| expect(page.locator('.mobile-layout-container')).to_be_visible(timeout=30000) | ||||||||||||||||
|
|
||||||||||||||||
| # Take a screenshot | ||||||||||||||||
| page.screenshot(path="jules-scratch/verification/verification.png") | ||||||||||||||||
|
Comment on lines
+12
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusiveActually verify the mobile scroll fix and chat input reachability. Right now we only assert container visibility. Also assert page is scrollable and that we can reach the chat input (selector via env for stability). - try:
- page.goto("http://localhost:3000")
-
- # Wait for the page to load by looking for a known element
- expect(page.locator('.mobile-layout-container')).to_be_visible(timeout=30000)
-
- # Take a screenshot
- page.screenshot(path="jules-scratch/verification/verification.png")
+ try:
+ page.goto("http://localhost:3000", wait_until="domcontentloaded")
+ page.set_default_timeout(30000)
+
+ # Wait for known layout container
+ expect(page.locator(".mobile-layout-container")).to_be_visible()
+
+ # Verify page is scrollable on mobile
+ is_scrollable = page.evaluate("""() => {
+ const el = document.scrollingElement || document.documentElement || document.body;
+ return el.scrollHeight > el.clientHeight;
+ }""")
+ if not is_scrollable:
+ raise AssertionError("Page is not scrollable on mobile viewport")
+
+ # Scroll to bottom to reach chat input area
+ page.evaluate("window.scrollTo(0, document.body.scrollHeight)")
+
+ # Optionally verify chat input visibility if provided
+ chat_sel = os.getenv("CHAT_INPUT_SELECTOR") # e.g., [data-testid='chat-input']
+ if chat_sel:
+ chat = page.locator(chat_sel)
+ chat.scroll_into_view_if_needed()
+ expect(chat).to_be_visible()
+
+ # Take a screenshot
+ os.makedirs("jules-scratch/verification", exist_ok=True)
+ page.screenshot(path="jules-scratch/verification/verification.png")🏁 Script executed: #!/bin/bash
# Set your app's stable chat input selector before running, e.g.:
# export CHAT_INPUT_SELECTOR="[data-testid='chat-input']"
python jules-scratch/verification/verify_mobile_scroll.pyLength of output: 244 Ensure Playwright is installed and configured before running the script pip install -r requirements-dev.txt
playwright installbefore executing 🤖 Prompt for AI Agents
Comment on lines
+18
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prevent screenshot write failures: create the output directory first. Without creating jules-scratch/verification, page.screenshot will fail. - # Take a screenshot
- page.screenshot(path="jules-scratch/verification/verification.png")
+ # Take a screenshot
+ os.makedirs("jules-scratch/verification", exist_ok=True)
+ page.screenshot(path="jules-scratch/verification/verification.png")
🤖 Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| except Exception as e: | ||||||||||||||||
| print(f"An error occurred: {e}") | ||||||||||||||||
| # Take a screenshot even if there is an error to help with debugging | ||||||||||||||||
| page.screenshot(path="jules-scratch/verification/error.png") | ||||||||||||||||
|
Comment on lines
+21
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Make failures visible in CI: print stack trace, save error screenshot reliably, and exit non‑zero. Currently errors only print a short message; the process still exits 0 if nothing else fails. - except Exception as e:
- print(f"An error occurred: {e}")
- # Take a screenshot even if there is an error to help with debugging
- page.screenshot(path="jules-scratch/verification/error.png")
+ except Exception as e:
+ # Ensure directory exists before saving artifacts
+ os.makedirs("jules-scratch/verification", exist_ok=True)
+ # Capture error screenshot and full traceback
+ page.screenshot(path="jules-scratch/verification/error.png")
+ traceback.print_exc()
+ sys.exit(1)
|
||||||||||||||||
|
|
||||||||||||||||
| finally: | ||||||||||||||||
| browser.close() | ||||||||||||||||
|
Comment on lines
+26
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Close the context explicitly before closing the browser. Not strictly required, but makes teardown clearer and future‑proof. finally:
- browser.close()
+ try:
+ context.close()
+ finally:
+ browser.close()📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| with sync_playwright() as playwright: | ||||||||||||||||
| run(playwright) | ||||||||||||||||
|
Comment on lines
+29
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid side effects on import: add a main guard. Running Playwright on import is risky (e.g., when tools import this module). Gate execution with a main guard. -with sync_playwright() as playwright:
- run(playwright)
+if __name__ == "__main__":
+ with sync_playwright() as playwright:
+ run(playwright)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Leverage build cache: copy manifests first, then the rest.
COPY-ing the whole context before
bun installdefeats layer caching. Copy manifests first, install, then copy sources. Also consider a.dockerignoreto exclude node_modules/.next/.git.Additionally add a
.dockerignore:🤖 Prompt for AI Agents