not trim the text input field values for every call of getUserAnswers, but only when the answer should be checked or the solution should be shown but not when the current state is stored,
will replace the use of H5P.trim (which is a remnant of old times) with the use of String.prototype.trim
trim comments with trailing spaces :-)
Background
When JI-3692 was merged, it introduced trimming the text input fields' values with every call of the getUserAnswer function. Supposedly, this was intended to fix issues with Wiris on H5P.com where codes were injected leading to wrong checks of the results.
As a side effect, however, whenever the current state was stored, the text input fields' values were also trimmed. This can cause confusion (and reportedly has) when more than one word is expected per blank, the user types and suddenly the space that was just typed gets removed.
It’s quite an edge case, as this is probably only noticeable rarely with the default timeout for saving the state at ~30 seconds. However, when that value is set lower (to 4 seconds in the reported case or on H5P.com where it seems to be dynamic), this issue can be noticed more frequently.
When merged in, will
getUserAnswers
, but only when the answer should be checked or the solution should be shown but not when the current state is stored,H5P.trim
(which is a remnant of old times) with the use ofString.prototype.trim
Background
When JI-3692 was merged, it introduced trimming the text input fields' values with every call of the
getUserAnswer
function. Supposedly, this was intended to fix issues with Wiris on H5P.com where
codes were injected leading to wrong checks of the results.As a side effect, however, whenever the current state was stored, the text input fields' values were also trimmed. This can cause confusion (and reportedly has) when more than one word is expected per blank, the user types and suddenly the space that was just typed gets removed.
It’s quite an edge case, as this is probably only noticeable rarely with the default timeout for saving the state at ~30 seconds. However, when that value is set lower (to 4 seconds in the reported case or on H5P.com where it seems to be dynamic), this issue can be noticed more frequently.