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

Add previous answers to MathQuill inputs on the next tick. #1072

Merged

Conversation

drgrice1
Copy link
Sponsor Member

This fixes openwebwork/mathquill#30. Although, I am not sure what is going on here. For some reason delaying filling in previous answers until the "next tick" (a timeout with 0 delay) fixes the problem. Probably the MathQuill math field is not fully initialized until after the mqeditor setup method completes.

I am unable to reproduce the issue using the development build of MathQuill directly via npm run serve.

@drgrice1 drgrice1 changed the base branch from develop to PG-2.19 May 1, 2024 20:57
Copy link
Sponsor Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the strange behavior.

@drgrice1 drgrice1 force-pushed the bugfix/mqeditor-last-answer-next-tick branch 3 times, most recently from f5bdd0f to e96920f Compare May 17, 2024 13:25
@drgrice1 drgrice1 force-pushed the bugfix/mqeditor-last-answer-next-tick branch from e96920f to ea4f8b4 Compare June 3, 2024 17:05
@drgrice1 drgrice1 force-pushed the bugfix/mqeditor-last-answer-next-tick branch from ea4f8b4 to eb34183 Compare June 14, 2024 15:06
@drgrice1 drgrice1 force-pushed the bugfix/mqeditor-last-answer-next-tick branch from eb34183 to d43bed0 Compare June 25, 2024 19:19
@drgrice1 drgrice1 force-pushed the bugfix/mqeditor-last-answer-next-tick branch from d43bed0 to 288c661 Compare July 2, 2024 19:58
@Alex-Jordan
Copy link
Contributor

I checked out a copy of PG-2.19 branch and merged this branch into it. Then I ran npm ci and restarted webwork2. But I still experience the issue. I looked at the minimized mqeditor file that my browser console says is in play, and I do see that it has the setTimeout that was added here. So I think that I've set up testing correctly, but the bug described at openwebwork/mathquill#30 still happens.

@drgrice1
Copy link
Sponsor Member Author

drgrice1 commented Jul 4, 2024

Experimenting with this more I see that sometimes it happens, and sometimes it doesn't. I increased the delay before the timeout executes to a tenth of a second. I haven't been able to reproduce it with that yet. However, it might still happen anyway.

I don't really think this pull request should be merged. I think more investigation is needed to determine what is really going on. I also don't think this is particularly high priority though. I think typing \\end in text mode is an edge case that won't happen much.

@Alex-Jordan
Copy link
Contributor

OK, FWIW, I pulled with the 100ms delay, and now I am not seeing the issue.

And no, this is not high priority. IIRC I was trying things that might demonstrate an insertion vulnerability and that exposed this. But no reasonable exercise would lead to a user inputting this kind of answer.

pstaabp and others added 3 commits July 9, 2024 16:12
…position-update

Update feedback popover position when typing in a MathQuill input.
This fixes openwebwork/mathquill#30.
Although, I am not sure what is going on here.    For some reason
delaying filling in previous answers until the "next tick" (a timeout
with 0 delay) fixes the problem.  Probably the MathQuill math field is
not fully initialized until after the mqeditor setup method completes.

I am unable to reproduce the issue using the development build of
MathQuill directly via `npm run serve`.
@drgrice1 drgrice1 force-pushed the bugfix/mqeditor-last-answer-next-tick branch from 8243a87 to 452128f Compare July 9, 2024 21:12
@Alex-Jordan
Copy link
Contributor

Merging this for now. Maybe there's a better solution to find later.

@Alex-Jordan Alex-Jordan merged commit 4b3e564 into openwebwork:PG-2.19 Jul 16, 2024
3 checks passed
drgrice1 added a commit that referenced this pull request Jul 16, 2024
…xt-tick

Add previous answers to MathQuill inputs on the next tick.
@drgrice1 drgrice1 deleted the bugfix/mqeditor-last-answer-next-tick branch July 16, 2024 19:26
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.

3 participants