From d693d34d05c1d6ac7332cdda5c2d92cf04e4c158 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Thu, 8 Feb 2018 13:51:40 -0500 Subject: [PATCH] update docs to clarify #499 --- docs/core_library/jspsych-core.md | 2 +- docs/core_library/jspsych-pluginAPI.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/core_library/jspsych-core.md b/docs/core_library/jspsych-core.md index 9b990aaa..818af274 100644 --- a/docs/core_library/jspsych-core.md +++ b/docs/core_library/jspsych-core.md @@ -295,7 +295,7 @@ The settings object can contain several parameters. The only *required* paramete Parameter | Type | Description --------- | ---- | ----------- timeline | array | An array containing the objects that describe the experiment timeline. See [Creating an Experiment: The Timeline](../overview/timeline.md). -display_element | string | The ID of an HTML element to display the experiment in. If left blank, then jsPsych will use the `` element to display content (creating it if necessary). You can override this parameter at the trial level as well by specifying a display_element property on any timeline. +display_element | string | The ID of an HTML element to display the experiment in. If left blank, jsPsych will use the `` element to display content (creating it if necessary). All keyboard event listeners are bound to this element. In order for a keyboard event to be detected, this element must have focus (be the last thing that the subject clicked on). on_finish | function | Function to execute when the experiment ends. on_trial_start | function | Function to execute when a new trial begins. on_trial_finish | function | Function to execute when a trial ends. diff --git a/docs/core_library/jspsych-pluginAPI.md b/docs/core_library/jspsych-pluginAPI.md index 4531a1b0..78618ad7 100644 --- a/docs/core_library/jspsych-pluginAPI.md +++ b/docs/core_library/jspsych-pluginAPI.md @@ -266,6 +266,8 @@ Return an object that uniquely identifies the keyboard listener. This object can Gets a keyboard response from the subject, recording the response time from when the function is first called until a valid response is generated. +The keyboard event listener will be bound to the `display_element` declared in `jsPsych.init()` (or the `` element if no `display_element` is specified). This allows jsPsych experiments to be embedded in websites with other content without disrupting the functionality of other UI elements. + A valid response triggers the `callback_function` specified in the parameters. A single argument is passed to the callback function. The argument contains an object with the properties `key` and `rt`. `key` contains the numeric key code of the response, and `rt` contains the response time. ### Examples