Skip to content

fix(flashcards): prevent unit page from auto-scrolling to flashcards … - #35

Merged
djoseph-apphelix merged 1 commit into
mainfrom
djoseph/LP-859
Jun 30, 2026
Merged

djoseph-apphelix merged 1 commit into
mainfrom
djoseph/LP-859

Conversation

@djoseph-apphelix

@djoseph-apphelix djoseph-apphelix commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

Summary

When a learner navigated to a unit whose first component is a video and second component is a flashcards game, the page automatically scrolled down to the flashcards instead of
staying at the top of the unit. This PR keeps the learner at the top of the unit page.

Problem

  • Reported behavior: Navigating into the unit jumps the viewport down to the flashcards, skipping past the video.
  • Acceptance criterion: The learner should land at the top of the unit page.

Jira ticket

LP-859

Copilot AI review requested due to automatic review settings June 30, 2026 06:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses LP-859 by preventing the unit page from auto-scrolling down to the Flashcards XBlock on initial load (notably when the unit starts with a video and Flashcards is the next component), keeping learners at the top of the unit as they enter.

Changes:

  • Removes the on-load focus call on the Flashcards “Start” button (the trigger for the unwanted unit scroll) while retaining the screen-reader announcement.
  • Updates in-game focus behavior to use focus({ preventScroll: true }) when starting the game.
  • Adds a regression test to ensure the on-load Start-button focus is not reintroduced and that the on-load announcement remains.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
games/static/js/src/flashcards.js Stops focusing the Start button on load (prevents unit auto-scroll) and updates focus handling when starting the game.
tests/handlers/test_flashcards_handlers.py Adds a regression test asserting on-load focus removal and announcement retention.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread games/static/js/src/flashcards.js
@djoseph-apphelix
djoseph-apphelix merged commit face76f into main Jun 30, 2026
2 of 4 checks passed
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.

3 participants