Skip to content

Fix tic-tac-toe board sizing on phones - #33

Merged
bashmohandes merged 1 commit into
masterfrom
codex/fix-tic-tac-toe-layout-for-mobile
Aug 12, 2026
Merged

bashmohandes merged 1 commit into
masterfrom
codex/fix-tic-tac-toe-layout-for-mobile

Conversation

@bashmohandes

Copy link
Copy Markdown
Owner

Motivation

  • The tic-tac-toe board collapses on narrow mobile viewports, making the game unusable on phones and touch devices.
  • Improve touch responsiveness and ensure the board stays square while preserving fixed cell sizing.

Description

  • Update tictactoe/styles.css to make the arena fill available width by setting .arena-wrap{width:100%;min-width:0;aspect-ratio:1} and to add touch-action: manipulation to .cell so taps behave correctly on touch devices.
  • Adjust the small-screen media rule to use margin-inline:auto for proper centering on narrow screens.
  • Update tests/tictactoe.test.js to assert the new .arena-wrap sizing and keep the existing assertions that the grid template and .cell min-width/min-height remain fixed.

Testing

  • Ran npm test, and all 36 tests passed.
  • Ran npm run check, and the static node --check validations completed successfully.
  • Attempted to run npx playwright to capture a mobile screenshot, but the tool install failed due to a 403 from the package registry so no browser-based screenshot was produced.

Codex Task

@bashmohandes
bashmohandes merged commit 84599a0 into master Aug 12, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 453694402f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tictactoe/styles.css
@@ -1,2 +1,2 @@
@import url('../styles/game.css');
.game-layout{align-items:start}.arena-wrap{display:grid;aspect-ratio:1;place-items:center;background:#14251f}.board{display:grid;width:82%;aspect-ratio:1;grid-template:repeat(3,minmax(0,1fr))/repeat(3,minmax(0,1fr));gap:8px;background:rgba(255,255,255,.28)}.cell{display:grid;min-width:0;min-height:0;padding:0;place-items:center;border:0;background:#14251f;color:var(--mark);font:700 clamp(58px,10vw,130px)/1 "DM Sans",sans-serif;cursor:pointer}.cell:hover:empty{background:#1d342c}.cell.win{background:#294c3e}.cell:disabled{cursor:default}.result-overlay{position:absolute;inset:0;display:grid;padding:20px;place-content:center;gap:12px;color:white;background:rgba(14,28,23,.8);text-align:center}.result-overlay[hidden]{display:none}.result-overlay strong{font-family:"DM Serif Display";font-size:42px;font-weight:400}.result-overlay .primary-button{width:auto}.difficulty{display:grid;gap:7px;color:var(--muted);font-size:11px;font-weight:700;text-transform:uppercase}.difficulty select{padding:12px;border:1px solid var(--line);border-radius:7px;color:var(--ink);background:var(--card)}@media(max-width:850px){.arena-wrap{max-width:620px;margin:auto}.online-panel,.color-controls,.difficulty{grid-column:auto}}
.game-layout{align-items:start}.arena-wrap{display:grid;width:100%;min-width:0;aspect-ratio:1;place-items:center;background:#14251f}.board{display:grid;width:82%;aspect-ratio:1;grid-template:repeat(3,minmax(0,1fr))/repeat(3,minmax(0,1fr));gap:8px;background:rgba(255,255,255,.28)}.cell{display:grid;min-width:0;min-height:0;padding:0;place-items:center;border:0;background:#14251f;color:var(--mark);font:700 clamp(58px,10vw,130px)/1 "DM Sans",sans-serif;cursor:pointer;touch-action:manipulation}.cell:hover:empty{background:#1d342c}.cell.win{background:#294c3e}.cell:disabled{cursor:default}.result-overlay{position:absolute;inset:0;display:grid;padding:20px;place-content:center;gap:12px;color:white;background:rgba(14,28,23,.8);text-align:center}.result-overlay[hidden]{display:none}.result-overlay strong{font-family:"DM Serif Display";font-size:42px;font-weight:400}.result-overlay .primary-button{width:auto}.difficulty{display:grid;gap:7px;color:var(--muted);font-size:11px;font-weight:700;text-transform:uppercase}.difficulty select{padding:12px;border:1px solid var(--line);border-radius:7px;color:var(--ink);background:var(--card)}@media(max-width:850px){.arena-wrap{max-width:620px;margin-inline:auto}.online-panel,.color-controls,.difficulty{grid-column:auto}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the short-viewport arena width cap

On viewports wider than 850px but at most 1180px, or wider than 850px with a height at most 900px—such as a phone in landscape—this unconditional width:100% comes after the imported styles/game.css and overrides its equal-specificity .arena-wrap { width:min(100%,calc((100dvh - 204px) * 1.6)); } media rule. Because that same rule makes .app-shell viewport-height and overflow:hidden, the now-square tic-tac-toe arena can expand to the full grid track and have its lower cells clipped off-screen; retain a viewport-height bound for the square arena or limit this override to the narrow, single-column breakpoint.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant