Skip to content

fix(session): count keyboard and touch as activity, not only mouse movement - #2338

Merged
hirokiterashima merged 1 commit into
WISE-Community:developfrom
Isaries:fix/session-activity-keyboard
Sep 4, 2026
Merged

fix(session): count keyboard and touch as activity, not only mouse movement#2338
hirokiterashima merged 1 commit into
WISE-Community:developfrom
Isaries:fix/session-activity-keyboard

Conversation

@Isaries

@Isaries Isaries commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

SessionService decides whether a user is active from lastActivityTimestamp, which was updated only by mouseMoved(). Its only callers were three @HostListener('document:mousemove') handlers, in vle.component.ts, authoring-tool.component.ts and classroom-monitor.component.ts.

Keyboard input and touch were therefore not treated as activity, so a user who is typing and not moving the mouse is considered inactive and is shown the session timeout warning while they are working.

To reproduce: sign in as a student, open a step with an Open Response component, and type using only the keyboard. With the default server.servlet.session.timeout=30m, calculateIntervals gives forceLogoutAfterWarningInterval = min(1800 * 0.1, 300) = 180 and showWarningInterval = 1800 - 180 = 1620, so "You have been inactive for a long time. Do you want to stay logged in?" appears over the editor after 27 minutes.

The changes:

  • keydown and touchstart join mousemove in all three components, so the three ways a user can interact all postpone the warning.
  • mouseMoved() is renamed userIsActive(), since it no longer answers a question about the mouse. The three components and the spec are the only callers.

Two notes on scope. The user is not necessarily logged out: checkForLogout() calls forceLogOut() only when the server reports the session inactive, and the 60 second autosave in node.component.ts keeps the server session alive while a component is dirty, so what this fixes is the interruption rather than a logout. And this is not #1038, which reports sessions not timing out at all.

touchstart is included because mousemove may never fire on a touch-only device, which would put a tablet user in the same position permanently.

…vement

SessionService decides whether a user is active from lastActivityTimestamp,
which was updated only by mouseMoved(), whose only callers were three
document:mousemove host listeners. A user who is typing, and not moving the
mouse, was therefore treated as inactive and shown the session timeout warning
while working.

With the default 30 minute timeout, calculateIntervals gives a
showWarningInterval of 1620 seconds, so the dialog appears after 27 minutes of
typing.

keydown and touchstart join mousemove in all three components, and mouseMoved
is renamed userIsActive because it no longer answers only about the mouse.
@hirokiterashima
hirokiterashima self-requested a review September 4, 2026 16:26
@hirokiterashima hirokiterashima self-assigned this Sep 4, 2026

@hirokiterashima hirokiterashima left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks for finding and addressing this issue.

Will merge despite the failed Github actions build phase. This is due to the PR coming from a fork branch and GitHub not making the AWS secrets available to the runner, not because there is an issue with the changeset. I was able to verify a build locally with this branch. The long-term solution is to use OIDC federation instead of static keys.

@hirokiterashima
hirokiterashima merged commit 1f68756 into WISE-Community:develop Sep 4, 2026
5 of 7 checks passed
@hirokiterashima

Copy link
Copy Markdown
Member

🎉 This PR is included in version 5.238.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants