fix: reset focus to app root after unit navigation - #2025
fix: reset focus to app root after unit navigation#2025jacobo-dominguez-wgu wants to merge 1 commit into
Conversation
|
Thanks for the pull request, @jacobo-dominguez-wgu! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2025 +/- ##
=======================================
Coverage 93.11% 93.12%
=======================================
Files 364 364
Lines 5939 5946 +7
Branches 1414 1417 +3
=======================================
+ Hits 5530 5537 +7
Misses 391 391
Partials 18 18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Should navigation stay on the bottom previous/next buttons in this scenario? That feels odd to me when all of the content above it has changed. I'd like to hear @kblemel's thoughts on this one. |
Before this pr, the focus stayed on the navigation buttons on the bottom even when the content changed, the intention is to move the focus to the content once one of the navigations buttons is clicked. |
Oh. I mixed up the before and after videos. This PR is making it so the focus goes back to the top upon navigation. That feels correct to me, but I'd still like to hear Kevin's thoughts to make sure there wasn't a specific reason behind the previous behavior I'm unaware of. |
Description
After an internal accessibility audit, the next problem was identified:
When a keyboard or screen-reader user activates the Next or Previous button at the bottom of a unit, focus remains on that button after the new unit loads. The user must manually navigate back up the page to reach the new content, violating WCAG 2.4.3 Focus Order (A).
Solution: After each unit or sequence navigation, programmatically move focus to
div.app-container(the MFE root), which is always present regardless of plugin slot customization. If that element is not found, focus falls back todocument.body.Testing
div.app-containerand not on the buttonDemo
After
Focus resets to the top after clicking next button:
Screen.Recording.2026-08-24.at.2.12.11.PM.mov
Before
Focus remains on the navigation buttons after clicking next button:
Screen.Recording.2026-08-24.at.2.15.46.PM.mov
AI usage notice
Used Claude Sonnet 4.6 through kiro to assist on this creation of this pr.