Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HFP-3792 Fix trimming #135

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

HFP-3792 Fix trimming #135

wants to merge 3 commits into from

Conversation

otacke
Copy link
Contributor

@otacke otacke commented Sep 13, 2023

When merged in, will

  • 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.

@otacke otacke changed the title Fix trimming HFP-3792 Fix trimming Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant