Skip to content

Fix white promotion menu layout drift and tile-size mismatch - #53

Draft
mterczynski with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-white-promotion-menu-bugs
Draft

Fix white promotion menu layout drift and tile-size mismatch#53
mterczynski with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-white-promotion-menu-bugs

Conversation

Copilot AI commented May 19, 2026

Copy link
Copy Markdown
Contributor

When playing as white, the promotion menu was horizontally misaligned, caused slight board width distortion when opened, and rendered promotion tiles larger than board tiles. This PR aligns the overlay to board columns and normalizes promotion tile geometry to match board tiles exactly.

  • Promotion menu positioning and sizing

    • Replaced pixel-based horizontal placement with board-relative file width (100 / 8) so the menu aligns to the selected file regardless of board scaling.
    • Set promotion menu width to one board file and each option tile to width: 100% + aspect-ratio: 1 for exact square parity with board tiles.
  • Border/layout isolation

    • Scoped board column border styling to actual board file elements only (via data-board-file), so the promotion overlay no longer participates in board border rules.
    • Removed overlay-induced border interactions that visually shrank/shifted the board when the menu appeared.
  • Implementation note (key change)

    const FILE_WIDTH_PERCENT = 100 / 8;
    
    const PromotionMenuContainer = styled.div<{ position: Position }>`
        position: absolute;
        left: ${({ position }) =>
            mapFileToFileIndex(position.file) * FILE_WIDTH_PERCENT}%;
        width: ${FILE_WIDTH_PERCENT}%;
        display: flex;
        flex-direction: column;
    `;
    
    const PieceSquare = styled.div`
        width: 100%;
        aspect-ratio: 1;
        box-sizing: border-box;
        border: ${settings.borderStyle};
        & + & { border-top: none; }
    `;

Copilot AI and others added 3 commits May 19, 2026 22:45
Agent-Logs-Url: https://github.com/mterczynski/chess/sessions/cec63a7a-dc82-425e-beee-7e6e2f34f376

Co-authored-by: mterczynski <27309340+mterczynski@users.noreply.github.com>
Agent-Logs-Url: https://github.com/mterczynski/chess/sessions/cec63a7a-dc82-425e-beee-7e6e2f34f376

Co-authored-by: mterczynski <27309340+mterczynski@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix promotion menu alignment and sizing issues for white Fix white promotion menu layout drift and tile-size mismatch May 19, 2026
Copilot AI requested a review from mterczynski May 19, 2026 22:47
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.

[Playing as white] Fix promotion menu related bugs

2 participants