Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.