From e22043f9dba6208bb4323c96ac5ff004818d1b1c Mon Sep 17 00:00:00 2001 From: KoyoNoguchi Date: Thu, 15 Oct 2026 18:59:41 +0900 Subject: [PATCH] Lock scrolling on the play screen (incl. iOS Safari) - Fix body to the viewport (position: fixed) and fit the whole table screen to the screen height; overflow: hidden alone does not stop iOS scrolling - Cancel one-finger touchmove to stop iOS rubber-band scrolling (range slider and an overflowing action bar are exempt; pinch zoom kept) - touch-action: manipulation to stop double-tap zoom - Compact layout for short screens (iPhone SE size) and 7+ players Co-Authored-By: Claude Opus 5.5 --- public/assets/style.css | 61 ++++++++++++++++++++++++++++++++++++----- public/assets/table.js | 16 +++++++++++ 2 files changed, 70 insertions(+), 7 deletions(-) diff --git a/public/assets/style.css b/public/assets/style.css index 736c021..9a4e1fc 100644 --- a/public/assets/style.css +++ b/public/assets/style.css @@ -283,8 +283,26 @@ input.invalid { border-color: var(--red); } .schedule span b { color: var(--gold); font-weight: 700; } /* ---------- プレイ画面 ---------- */ -.table-page { display: flex; flex-direction: column; min-height: 100dvh; } -.table-page .wrap { padding-top: 16px; padding-bottom: 0; flex: 1; display: flex; flex-direction: column; width: 100%; } +/* プレイ画面はスクロールさせない。 + iOS Safari は body の overflow: hidden だけではスクロール・バウンスが止まらないため、 + body を position: fixed で画面に固定し、全体を画面の高さに収める(1本指の touchmove は table.js で止める) */ +html:has(body.table-page) { overflow: hidden; overscroll-behavior: none; } +body.table-page { + position: fixed; + inset: 0; + height: 100%; + min-height: 0; + overflow: hidden; + overscroll-behavior: none; + display: flex; + flex-direction: column; + touch-action: manipulation; /* ダブルタップでの拡大を防ぐ(ピンチ拡大は残す) */ + -webkit-user-select: none; + user-select: none; + -webkit-touch-callout: none; +} +.table-page input { -webkit-user-select: text; user-select: text; } +.table-page .wrap { padding-top: 12px; padding-bottom: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; } .table-header { display: flex; align-items: center; gap: 12px; } .table-header h1 { @@ -319,8 +337,8 @@ input.invalid { border-color: var(--red); } .felt-area { position: relative; flex: 1; - min-height: 340px; - margin: 20px 0 24px; + min-height: 0; + margin: 46px 0 40px; /* 上下の席が楕円の外にはみ出す分 */ } .felt { position: absolute; @@ -438,9 +456,12 @@ input.invalid { border-color: var(--red); } } .action-bar { - position: sticky; - bottom: 0; + flex: none; + position: relative; z-index: 5; + max-height: 62%; + overflow-y: auto; /* サイドポットが多いときだけ中でスクロール */ + overscroll-behavior: contain; background: #161c19; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); } @@ -586,7 +607,6 @@ input.invalid { border-color: var(--red); } .pot-tag { font-size: 9px; background: rgba(255, 255, 255, 0.2); padding: 0 4px; border-radius: 4px; margin-right: 4px; } /* 7人以上 */ -.felt-area.crowded { min-height: 420px; } .crowded .seat { width: 80px; } .crowded .avatar { width: 46px; height: 46px; } .crowded .avatar svg { width: 22px; height: 22px; } @@ -618,6 +638,33 @@ input.invalid { border-color: var(--red); } .raise-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--orange); height: 28px; } .raise-row input[type="number"] { width: 100px; flex: none; font-size: 16px; padding: 8px 10px; } +/* 背の低い画面(iPhone SE など)では詰める */ +@media (max-height: 700px) { + .table-page .wrap { padding-top: 8px; } + .table-header .icon-btn { width: 38px; height: 38px; font-size: 16px; } + .table-header h1 { font-size: 18px; } + .host-controls { margin: 8px 0 6px; } + .host-controls .btn { padding: 7px 14px; } + .host-spacer { height: 6px; } + .level-bar { padding: 8px 14px; } + .level-sub { display: none; } + .felt-area { margin: 40px 0 34px; } + .pot { font-size: 30px; } + .avatar { width: 46px; height: 46px; } + .avatar svg { width: 22px; height: 22px; } + .action-bar { padding-top: 8px; } + .my-stack { font-size: 20px; } + .me-row { margin-bottom: 2px; } + .status-line { margin-bottom: 6px; } + .actions .btn { min-height: 46px; padding: 10px 4px; } + .crowded .avatar { width: 34px; height: 34px; border-width: 2px; } + .crowded .avatar svg { width: 16px; height: 16px; } + .crowded .nameplate { margin-top: -6px; padding: 2px 5px; min-width: 64px; } + .crowded .nameplate .pname { font-size: 10px; } + .crowded .nameplate .pstack { font-size: 11px; } + .crowded .chip-marker { width: 20px; height: 20px; font-size: 10px; } +} + [hidden] { display: none !important; } /* ---------- ユーティリティ(CSP で style 属性を使わないため) ---------- */ diff --git a/public/assets/table.js b/public/assets/table.js index dde3e36..eaa0f0b 100644 --- a/public/assets/table.js +++ b/public/assets/table.js @@ -504,5 +504,21 @@ toast('サイトのリンクをコピーしました'); }); + // iOS Safari は CSS だけではページのスクロール・引っ張り(バウンス)を止められないので、 + // 1本指のドラッグを止める。スライダーと、中身がはみ出している操作エリアは除く。 + // 2本指(ピンチ拡大)はアクセシビリティのため止めない。 + document.addEventListener( + 'touchmove', + (e) => { + if (e.touches.length !== 1) return; + const t = e.target; + if (t.closest && t.closest('input[type="range"]')) return; + const bar = t.closest && t.closest('.action-bar'); + if (bar && bar.scrollHeight > bar.clientHeight) return; + if (e.cancelable) e.preventDefault(); + }, + { passive: false } + ); + ensureName(); })();