Repository navigation
Require legal move validation before showing promotion UI - #9
Open
anas-asghar4831 with Copilot wants to merge 2 commits into
Open
anas-asghar4831 with Copilot wants to merge 2 commits into
anas-asghar4831 with Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix promotion picker for illegal pawn drags to back rank
Require legal move validation before showing promotion UI
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Illegal pawn drags to the back rank were being treated as promotion attempts based only on the destination rank, which caused the promotion picker to appear for moves that chess.js would reject. This change makes promotion detection contingent on actual move legality so illegal drags snap back without opening promotion UI.
Promotion gating
isPromotionMoveinsrc/board.tsxto require both:boardState.getLegalMoves(from)Behavioral impact
autoPromoteTo, externalonPromotion, built-in picker)Implementation