Skip to content

Fix controls panel clipping on small/mobile screens#29

Merged
dnkats merged 2 commits into
mainfrom
fix/mobile-responsive-controls
Jun 2, 2026
Merged

Fix controls panel clipping on small/mobile screens#29
dnkats merged 2 commits into
mainfrom
fix/mobile-responsive-controls

Conversation

@dnkats

@dnkats dnkats commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

Fixes both vertical and horizontal clipping of the controls sidebar on small/mobile windows, where buttons (e.g. xtb, ElemCo) could become unreachable.

Changes (CSS only, css/styles.css)

  • Vertical scroll (all screen sizes): #controls now scrolls internally (height: 100vh; overflow-y: auto), so bottom buttons stay reachable when the window is shorter than the panel.
  • Horizontal clipping (≤768px): a media query stacks the layout into a single scrollable column — the viewer goes full-width above the controls, min-width: 0 overrides the 400px minimum that forced overflow, and the page scrolls vertically. The existing ResizeObserver on #viewer reflows the JSmol canvas automatically.
  • Reset button: slimmed the zoom Reset button (min-width: 70px50px, tighter padding) so it no longer overflows the edge on narrow screens.

No JavaScript changes.

Testing

Open index.html and use the browser's responsive/device mode (or a real phone): below 768px the controls appear full-width under the viewer with vertical page scroll and no horizontal cutoff; at wider widths the original side-by-side layout is unchanged, now with the sidebar scrolling when taller than the window.

🤖 Generated with Claude Code

dnkats and others added 2 commits June 2, 2026 08:41
Make the controls sidebar scroll vertically when taller than the
window, and stack the layout into a single scrollable column on
narrow screens so the sidebar is no longer clipped horizontally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 2, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

CSS-only fix to prevent the controls sidebar from being clipped on small/mobile screens. Adds internal vertical scrolling to the sidebar at all sizes, and introduces a ≤768px media query that stacks the viewer above a full-width controls panel. Also slims the zoom Reset button so it doesn't overflow narrow widths.

Changes:

  • Make #controls a fixed-width, non-shrinking column with its own vertical scroll (height: 100vh; overflow-y: auto).
  • Add @media (max-width: 768px) rules to stack #container vertically and let #controls expand to full width with page-level scroll.
  • Reduce the Reset zoom button's min-width from 70px to 50px with tighter padding.

@dnkats dnkats merged commit c28ff64 into main Jun 2, 2026
1 check passed
@dnkats dnkats deleted the fix/mobile-responsive-controls branch June 2, 2026 06:51
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