Skip to content

Fix LogViewer mobile scrolling via touch fallback#164

Merged
khaliqgant merged 2 commits intomainfrom
fix/logviewer-mobile-scroll-v4
Jan 12, 2026
Merged

Fix LogViewer mobile scrolling via touch fallback#164
khaliqgant merged 2 commits intomainfrom
fix/logviewer-mobile-scroll-v4

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary\n- add touchmove-based scroll fallback on xterm viewport for coarse pointers\n- prevent default scrolling when viewport can scroll\n- ensure viewport exists before binding touch handlers\n- extend pointer-events override to helper textarea\n\n## Testing\n- not run

@my-senior-dev-pr-review
Copy link
Copy Markdown

🤖 My Senior Dev — Analysis Complete

👤 For @khaliqgant

📁 Expert in src/dashboard/react-components/ (6 edits) • ⚡ 22nd PR this month

View your contributor analytics →


📊 1 file reviewed • 1 high risk • 4 need attention

🚨 High Risk:

  • src/dashboard/react-components/XTermLogViewer.tsx — Critical edge case considerations with event listeners and potential runtime errors.

⚠️ Needs Attention:

  • src/dashboard/react-components/XTermLogViewer.tsx — Important performance implications and logic handled by event listeners may affect user interactions.

🚀 Open Interactive Review →

The full interface unlocks features not available in GitHub:

  • 💬 AI Chat — Ask questions on any file, get context-aware answers
  • 🔍 Smart Hovers — See symbol definitions and usage without leaving the diff
  • 📚 Code Archeology — Understand how files evolved over time (/archeology)
  • 🎯 Learning Insights — See how this PR compares to similar changes

💬 Chat here: @my-senior-dev explain this change — or try @chaos-monkey @security-auditor @optimizer @skeptic @junior-dev

📖 View all 12 personas & slash commands

You can interact with me by mentioning @my-senior-dev in any comment:

In PR comments or on any line of code:

  • Ask questions about the code or PR
  • Request explanations of specific changes
  • Get suggestions for improvements

Slash commands:

  • /help — Show all available commands
  • /archeology — See the history and evolution of changed files
  • /profile — Performance analysis and suggestions
  • /expertise — Find who knows this code best
  • /personas — List all available AI personas

AI Personas (mention to get their perspective):

Persona Focus
@chaos-monkey 🐵 Edge cases & failure scenarios
@skeptic 🤨 Challenge assumptions
@optimizer Performance & efficiency
@security-auditor 🔒 Security vulnerabilities
@accessibility-advocate Inclusive design
@junior-dev 🌱 Simple explanations
@tech-debt-collector 💳 Code quality & shortcuts
@ux-champion 🎨 User experience
@devops-engineer 🚀 Deployment & scaling
@documentation-nazi 📚 Documentation gaps
@legacy-whisperer 🏛️ Working with existing code
@test-driven-purist Testing & TDD

For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews.

@khaliqgant khaliqgant requested a review from Copilot January 12, 2026 14:39
@khaliqgant khaliqgant merged commit bea64b7 into main Jan 12, 2026
6 checks passed
@khaliqgant khaliqgant deleted the fix/logviewer-mobile-scroll-v4 branch January 12, 2026 14:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes mobile touch scrolling in the LogViewer component by implementing a touchmove-based fallback for coarse pointer devices. The changes ensure proper scroll behavior on mobile devices by binding touch handlers directly to the xterm viewport and preventing default scrolling when the viewport has scrollable content.

Changes:

  • Added terminal readiness state to ensure viewport exists before binding touch handlers
  • Modified touch event listeners to attach directly to viewport instead of container
  • Added preventDefault logic to prevent default scrolling when viewport can scroll
  • Extended pointer-events CSS override to helper textarea

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

container.addEventListener('touchstart', handleTouchStart, { passive: true });
container.addEventListener('touchmove', handleTouchMove, { passive: true });
viewport.addEventListener('touchstart', handleTouchStart, { passive: true });
viewport.addEventListener('touchmove', handleTouchMove, { passive: false });
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The touchmove event listener is registered with passive: false, which is necessary for preventDefault() to work. However, the preventDefault() call inside handleTouchMove is conditional. If viewport.scrollHeight > viewport.clientHeight is false, the event will not be prevented, but the browser will still treat it as non-passive, which can impact scroll performance. Consider restructuring to only register as non-passive when necessary, or ensure the conditional logic is correct to avoid unnecessary performance impact.

Copilot uses AI. Check for mistakes.
@@ -377,6 +384,7 @@ export function XTermLogViewer({
max-height: 100%;
touch-action: pan-y !important;
overscroll-behavior: contain;
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The addition of pointer-events: auto to the helper textarea lacks a comment explaining its purpose. Given that this is part of a mobile scrolling fix, it would be helpful to document why this override is necessary and how it relates to the touch event handling changes.

Suggested change
overscroll-behavior: contain;
overscroll-behavior: contain;
/* Allow the viewport to receive pointer events (selection, wheel/mouse) by default.
On coarse pointers (mobile Safari), child elements have pointer-events disabled
in the media query below so vertical pan gestures can reach this scrollable area. */

Copilot uses AI. Check for mistakes.
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