Skip to content

Resizing the viewport restarts an in-progress interactive instrument #1480

Description

@CMonnin

Reported downstream in DouglasNeuroInformatics/CPPQ#103.

What happens

Resizing the Google Chrome window while an interactive instrument is in progress restarts the task, returning the participant to the instructions page. Observed on TMB_VISUAL_PA_STUDY and TMB_MATRIX_REASONING.

Why this is a data-integrity bug, not a cosmetic one

For TMB_VISUAL_PA_STUDY a restart means the participant sees the image pairs a second time. That instrument is the study phase of a paired-associates memory test — a second exposure invalidates the subsequent recall score, and nothing in the recorded data indicates it happened. The affected record looks like a normal, valid one.

So the failure is silent: the score is wrong and nothing flags it. Same shape of problem for any timed or exposure-limited task.

Evidence it's host-side, not in the tasks

Neither task source contains any resize or viewport handling — no resize listener, no ResizeObserver, no window.innerWidth / innerHeight / clientWidth reads, no matchMedia, no orientationchange:

$ grep -in "resize\|innerWidth\|innerHeight\|clientWidth\|matchMedia\|orientationchange\|ResizeObserver" \
    lib/interactive/TMB_VISUAL_PA_STUDY/index.ts lib/interactive/TMB_MATRIX_REASONING/index.ts
(no matches)

(in DouglasNeuroInformatics/ODC_instruments, 371 and 569 lines respectively)

The tasks have no way to react to a resize themselves, so the remount is coming from the interactive-instrument host — something in the render path keyed on viewport dimensions, remounting the task component on a size change.

Expected behaviour

Resizing the viewport must not remount, restart, or reset an in-progress interactive instrument. The task should keep its state across viewport changes.

Questions

  • Can the remount be confirmed in the interactive instrument host? (@joshunrau — this was your read on CPPQ#103 too)
  • Is the state loss recoverable, or does it need the host to stop remounting in the first place?
  • Can already-affected sessions be identified retrospectively? If a restart leaves any trace at all, existing CPPQ records may need auditing.

🤖 Generated with Claude Code

Activity

  1. joshunrau commented on Aug 26, 2026

    @joshunrau
    Collaborator

    Closing: not reproducible, and the evidence in the report is wrong

    The tasks do handle resize. The grep behind this issue only covered index.ts. Every TMB task also ships two vendored scripts, and TestHelper.v1.May23.js / TestHelper.v1.Oct23.js registers resize, visualViewport resize and orientationchange handlers in setBodyScale() (lines 844-848), which every TMB task calls. So "the tasks have no way to react to a resize" does not hold, and the conclusion drawn from it — that the remount must be host-side — does not follow.

    We could not reproduce the reset. We ran TMB_VISUAL_PA_STUDY with a counter on every reload of the task's frame, while resizing the window (simulated and real), resizing 24 times rapidly, and forcing the browser out of fullscreen mid-task. Zero reloads. The task played all 24 image pairs through to the end screen.

    We do not know what causes it. We don't fully understand the TMB legacy scripts — they're vendored, undocumented, and we won't be modifying them. The reset could originate in that code or in ODC; nothing we have distinguishes the two. What we can say is that no host-side viewport handling remounts the task, which is the specific claim this issue was filed on.

    Closing as not reproducible. If it happens again, reopen with the template below — it asks for the few things that would tell these apart.


    If it happens again

    Best case: record your screen. Windows Win+Alt+R, Mac Cmd+Shift+5. A ten-second clip beats everything below.

    Otherwise, screenshot it the moment it happens (Windows Win+Shift+S, Mac Cmd+Shift+4) and fill in as much of this as you can. Partial is fine.

    1. Date and time (to the minute):
       ______________________
    
    2. Task:  [ ] Visual Paired Associates - Study   [ ] Matrix Reasoning
              [ ] Other: ______________________
    
    3. How far in?  (e.g. "pair 12 of 24", "just started")
       ______________________
    
    4. MOST IMPORTANT - did the WHOLE page reload, or only the task?
       Look at the blue sidebar and the Overview-Content-Summary bar at the top.
       [ ] Whole screen went blank and redrew, like pressing refresh
       [ ] Sidebar and top bar stayed put; only the middle changed
       [ ] Not sure
    
    5. Any error message, red text, or "Try again" screen - even for a second?
       [ ] Yes: ______________________    [ ] No    [ ] Not sure
    
    6. What did you do just before? Tick all that apply.
       [ ] Dragged the window edge/corner     [ ] Maximised or un-maximised
       [ ] Pressed F11                        [ ] Pressed Esc
       [ ] Minimised, or switched program     [ ] Plugged in / moved to another monitor
       [ ] Closed or opened the laptop lid    [ ] Other key: ______________
       [ ] Nothing, it just happened
    
    7. Was the task filling the whole screen (no tabs or address bar visible)?
       [ ] Yes    [ ] No    [ ] Not sure
    
    8. Error log (~20 seconds):
       Press F12 > click the "Console" tab > screenshot it > press F12 to close.
       Skip this if the panel doesn't open.
    

    Question 4 alone narrows this considerably.

    If you're about to run a session where this might recur: press F12, click Console, tick Preserve log, leave the panel open. That keeps the log alive through a reload — currently the exact moment we lose the evidence.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions