Repository navigation
Keep keyboard focus inside the tutorial overlay - #232
Merged
Merged
Conversation
The tutorial overlay said it was a modal dialog but did not contain focus. Tab from Skip Tutorial reached the shell's skip link and the game's welcome buttons behind it, which could be activated. While the slides are open, the rest of the page is now inert and aria-hidden, as the History modal does. The overlay sits inside the game container, not under <body>, so the siblings of the overlay and of each ancestor up to <body> are marked. Closing restores only what was changed and returns focus to the control that opened the tutorial. Every path that removes the overlay (finish, skip, Start Practice, cancel) goes through one close function. Fixes #221 Signed: Claude Code (Claude Opus 5.5) for Aaron Crosman Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #221
Change
The tutorial overlay has
role="dialog"andaria-modal="true"but did not trap focus. Tab could reach the page behind it. Now, while the overlay is open,tutorialService.jsmakes the rest of the pageinertandaria-hidden, as the History modal does. The overlay sits inside the game container, so the service marks the siblings of the overlay and of each of its ancestors up to<body>, not onlybody > *. Closing the overlay undoes only what it changed and returns focus to the control that opened it. All four ways the overlay closes (finish, skip, Start Practice, cancel) go through oneclosefunction.Testing
tutorialService.test.js; 5 of them fail onmain. Lint is clean, andnpm run test:coveragepasses (2124 tests).--user-data-dir. In Fast Piggie, Tab and Shift+Tab now cycle only between Next and Skip Tutorial. The page is fully restored after Skip and after Start Practice, and the practice coach takes focus.After Skip, focus still lands on
<body>, because starting the session hides the welcome panel. That is #222 and is not changed here.Signed: Claude Code (Claude Opus 5.5) for Aaron Crosman
🤖 Generated with Claude Code