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

Missplaced popup when showing correct answers in problem editor #2524

Closed
somiaj opened this issue Aug 17, 2024 · 8 comments
Closed

Missplaced popup when showing correct answers in problem editor #2524

somiaj opened this issue Aug 17, 2024 · 8 comments

Comments

@somiaj
Copy link
Contributor

somiaj commented Aug 17, 2024

When clicking 'Show Correct Answers" while testing problems in the problem editor, the feedback popup with the answer defaults to open, but gets put in the wrong place due to the time it takes MathJax to resize the math content, so the feedback button moves after the popup. Here is the result:

image

@somiaj
Copy link
Contributor Author

somiaj commented Aug 17, 2024

Note closing and opening the popup puts it back into the right spot.

@somiaj
Copy link
Contributor Author

somiaj commented Aug 18, 2024

I noticed I don't have this issue in chromium, and have also noticed some other issues with mathjax that also go away using chromium (if you see in this screenshot you'll see there is no padding on the right of the formula before the matrix brace, but it works in chromium or if I use the chtml render). So I suspect the issue is with firefox-esr version 115, which will hit the end of its life in the next month or so.

If no one else can reproduce these issues, or they go away when I upgrade firefox, I'll just close this as a firefox-esr 115 issue.

@drgrice1
Copy link
Member

I don't see this issue in Firefox 128.0.3 (not esr), nor in Google Chrome.

You could experiment with the timeout in pg/htdocs/js/Feedback.js on line 73. Try increasing the delay from 100 and see if that fixes it.

This is another one of those cases where the timeout is not the best solution. This may have nothing to do with Firefox or your version of it, but may be just a processing delay (perhaps your computer is a bit slower than mine!). If this is a persistent issue I will look into a better way of doing that. Perhaps working it into the MathJax promise.

@drgrice1
Copy link
Member

In fact, here is a better trial. Try changing line 17 of pg/htdocs/js/Feedback.js to

				MathJax.startup.promise = MathJax.startup.promise.then(() =>
					MathJax.typesetPromise(['.popover-body']).then(() => feedbackPopover.update())
				);

and delete line 73. See if that works better.

@somiaj
Copy link
Contributor Author

somiaj commented Aug 18, 2024

@drgrice1 that did fix the positioning issues with the popup in my testing so far, so would fix the original issue of placement of the popup.

@Alex-Jordan
Copy link
Contributor

Fixed by #1098 and #1097.

@somiaj
Copy link
Contributor Author

somiaj commented Sep 1, 2024

@drgrice1 I ran across another similar issue, but this time with MathQuill, so the popup completes before MathQuill answer boxes are done resizing. Probably due to my 'slow' machine, here are some screenshots.

image

The actual button feedback button is here

image

Not a big deal, but if there is an easy fix it would be nice.

@somiaj
Copy link
Contributor Author

somiaj commented Sep 1, 2024

Note, there is very little MathJax in this problem, so the MathJax in this case finishes rendering before MathQuill does.

drgrice1 added a commit to drgrice1/pg that referenced this issue Sep 1, 2024
…nputs.

When an answer has multiple responses and a MathQuill input for a
response that is not the first one is typed in with a feedback popover
open, the feedback popover does not correctly resposition. This is
because currently only the first answer label is saved in the data
attribute.  So when the mqeditor sets up the later responses which have
different answer labels, it doesn't see the feedback button.  So now all
answer labels for the response group are saved as a JSON encoded array.
The mqeditor then searches the feedback buttons on the page to find the
one with the correct answer label.

Here is a MWE for testing this:
```perl
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl');
Context('Matrix');
$A = Matrix([ [ 0, -1 ], [ 1, 0 ] ]);
BEGIN_PGML
Enter [`[$A]`]: [_]*{$A}{10}
END_PGML
ENDDOCUMENT();
```

If you type in a matrix entry other than the first column of the first
row when a feedback popover is open, then the popover position is not
updated with the develop branch, but is with this pull request.

Note that this also occurs with `MultiAnswer` objects with
`singleResult => 1` set.

Now, I was actually trying to fix @somiaj's comment in
openwebwork/webwork2#2524 (comment).
I believe that this might also fix that issue.  I can't test that
because I can't reproduce this issue (my computer is to fast?). However,
I have good reason to believe that this will fix it.
somiaj pushed a commit to somiaj/pg that referenced this issue Sep 1, 2024
…nputs.

When an answer has multiple responses and a MathQuill input for a
response that is not the first one is typed in with a feedback popover
open, the feedback popover does not correctly resposition. This is
because currently only the first answer label is saved in the data
attribute.  So when the mqeditor sets up the later responses which have
different answer labels, it doesn't see the feedback button.  So now all
answer labels for the response group are saved as a JSON encoded array.
The mqeditor then searches the feedback buttons on the page to find the
one with the correct answer label.

Here is a MWE for testing this:
```perl
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl');
Context('Matrix');
$A = Matrix([ [ 0, -1 ], [ 1, 0 ] ]);
BEGIN_PGML
Enter [`[$A]`]: [_]*{$A}{10}
END_PGML
ENDDOCUMENT();
```

If you type in a matrix entry other than the first column of the first
row when a feedback popover is open, then the popover position is not
updated with the develop branch, but is with this pull request.

Note that this also occurs with `MultiAnswer` objects with
`singleResult => 1` set.

Now, I was actually trying to fix @somiaj's comment in
openwebwork/webwork2#2524 (comment).
I believe that this might also fix that issue.  I can't test that
because I can't reproduce this issue (my computer is to fast?). However,
I have good reason to believe that this will fix it.
drgrice1 added a commit to drgrice1/pg that referenced this issue Sep 3, 2024
…nputs.

When an answer has multiple responses and a MathQuill input for a
response that is not the first one is typed in with a feedback popover
open, the feedback popover does not correctly resposition. This is
because currently only the first answer label is saved in the data
attribute.  So when the mqeditor sets up the later responses which have
different answer labels, it doesn't see the feedback button.  So now all
answer labels for the response group are saved as a JSON encoded array.
The mqeditor then searches the feedback buttons on the page to find the
one with the correct answer label.

Here is a MWE for testing this:
```perl
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl');
Context('Matrix');
$A = Matrix([ [ 0, -1 ], [ 1, 0 ] ]);
BEGIN_PGML
Enter [`[$A]`]: [_]*{$A}{10}
END_PGML
ENDDOCUMENT();
```

If you type in a matrix entry other than the first column of the first
row when a feedback popover is open, then the popover position is not
updated with the develop branch, but is with this pull request.

Note that this also occurs with `MultiAnswer` objects with
`singleResult => 1` set.

Now, I was actually trying to fix @somiaj's comment in
openwebwork/webwork2#2524 (comment).
I believe that this might also fix that issue.  I can't test that
because I can't reproduce this issue (my computer is to fast?). However,
I have good reason to believe that this will fix it.
drgrice1 added a commit to drgrice1/pg that referenced this issue Sep 3, 2024
…nputs.

When an answer has multiple responses and a MathQuill input for a
response that is not the first one is typed in with a feedback popover
open, the feedback popover does not correctly resposition. This is
because currently only the first answer label is saved in the data
attribute.  So when the mqeditor sets up the later responses which have
different answer labels, it doesn't see the feedback button.  So now all
answer labels for the response group are saved as a JSON encoded array.
The mqeditor then searches the feedback buttons on the page to find the
one with the correct answer label.

Here is a MWE for testing this:
```perl
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl');
Context('Matrix');
$A = Matrix([ [ 0, -1 ], [ 1, 0 ] ]);
BEGIN_PGML
Enter [`[$A]`]: [_]*{$A}{10}
END_PGML
ENDDOCUMENT();
```

If you type in a matrix entry other than the first column of the first
row when a feedback popover is open, then the popover position is not
updated with the develop branch, but is with this pull request.

Note that this also occurs with `MultiAnswer` objects with
`singleResult => 1` set.

Now, I was actually trying to fix @somiaj's comment in
openwebwork/webwork2#2524 (comment).
I believe that this might also fix that issue.  I can't test that
because I can't reproduce this issue (my computer is to fast?). However,
I have good reason to believe that this will fix it.
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

No branches or pull requests

3 participants