1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-11 16:18:10 +00:00

BF: When closing DlgFromDict, call eventmanager.clearEvents to clear events accumulated during dialog

Since DlgFromDict does not consume any events or keypresses, PsychoJS._keybuffer will be full of keypresses which may cause undesired outcomes when the experiment starts and the keypresses are processed.

Example bug-causing sequence:
- User presses ESC during DlgFromDict
- Nothing appears to happen (correct expected result)
- User completes the fields on DlgFromDict and presses Ok
- Next routine starts and then...

Bug behavior:
- User is unexpectedly presented with a "The [Escape] key was pressed. Goodbye!" dialog.

Correct behavior:
- Nothing should happen. ESC was pressed during the DIgFromDict, not this routine.

Reason the bug happens:
The ESC keypress during DlgFromDict was not consumed, so it is picked up by a [routine_name]RoutineEachFrame() in the scheduler, which checks for ESC keypresses, finds a ESC in the keybuffer, and unexpectedly stops the experiment.
This commit is contained in:
Sijia Zhao 2021-02-12 03:09:50 +00:00
parent 3ee07c994c
commit 42ebec383e

View File

@ -235,6 +235,9 @@ export class GUI
// switch to full screen if requested:
self._psychoJS.window.adjustScreenSize();
// clear accumulated events
self._psychoJS.eventManager.clearEvents(undefined);
}
},
{