h5p / h5p-blanks

9 stars 68 forks source link

HFP-3792 Fix trimming #135

Open otacke opened 1 year ago

otacke commented 1 year ago

When merged in, will

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.