Skip to content

fix: reset focus to app root after unit navigation - #2025

Open
jacobo-dominguez-wgu wants to merge 1 commit into
openedx:masterfrom
WGU-Open-edX:fix/a11y-focus-navigation
Open

fix: reset focus to app root after unit navigation#2025
jacobo-dominguez-wgu wants to merge 1 commit into
openedx:masterfrom
WGU-Open-edX:fix/a11y-focus-navigation

Conversation

@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor

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 to document.body.

Testing

  • Unit tests pass
  • Manual keyboard navigation test: tab to Next button, press Enter, confirm focus lands on div.app-container and not on the button
  • Screen reader test (VoiceOver / NVDA): confirm no unexpected announcement on focus landing at the container

Demo

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.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Aug 24, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @jacobo-dominguez-wgu!

This repository is currently maintained by @openedx/committers-frontend-app-learning.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Aug 24, 2026
@jacobo-dominguez-wgu
jacobo-dominguez-wgu requested a review from a team August 24, 2026 20:22
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.12%. Comparing base (09e57e0) to head (a5bd8a7).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

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.

@jacobo-dominguez-wgu

jacobo-dominguez-wgu commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

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.
Or, should we keep the focus on the buttons regardless of the content change?

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

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. Or, should we keep the focus on the buttons regardless of the content change?

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.

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

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

5 participants