-
-
Couldn't load subscription status.
- Fork 81
Fix feedback previews when the display mode is "images". #1323
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
base: develop
Are you sure you want to change the base?
Fix feedback previews when the display mode is "images". #1323
Conversation
1b9b2e8 to
3dba462
Compare
|
Aren't images for formulas also going to have accessibility issues? This could be another reason to drop support for them. |
|
The images do provide an alt attribute. The alt attribute is the LaTeX that is used to generate the equation. That may not be very good, but it is something. |
|
When you change the "Display Settings" from the "User Settings" page, it does change the display mode that is used. However, there are some cases where the previous setting will persist after you make that change. For example, if you have a problem open in one tab and have navigated around using page links (so that the |
Currently if the display mode is "images", then the student and correct answer previews don't work. The images are never actually rendered, thus the image files are never created, and so the `alt` value is shown which is the original TeX for the answer. The reason for this is that the image generator runs before the post content processor runs. So equation images in the problem are rendered, but not those in the feedback. That was done because of the hack of inserting the string `MaRkEr` followed by the image number hash when the image is initially inserted into the problem text, and then later replacing that with the alignment styel when the image is rendered. That results in invalid HTML which `Mojo::DOM` doesn't like. To fix the issue the `MaRkEr` hack is reworked. Instead of that string, a `data-imagegen-alignment-marker` attribute is used whose value is the image number hash. Since that is valid HTML, `Mojo::DOM` is fine with it and leaves it as it is. So the image generator can now be run after the post content processor runs, and that renders the images in feedback as well. Care is needed for the images in feedback when the `data-imagegen-alignment-marker` is replaced. Since the rendered `img` tag is inside the `data-bs-content` attribute of the feedback button, it is HTML encoded. So instead of double quotes, the HTML double quote escape character (") is used.
3dba462 to
ec8627c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still in favor of removing images display mode altogether, but this is a good fix and we can decide about removing this at a later time.
|
Yeah, I think it would be good to leave the image generator in working order before we remove it! |

Currently if the display mode is "images", then the student and correct answer previews don't work. The images are never actually rendered, thus the image files are never created, and so the
altvalue is shown which is the original TeX for the answer. The reason for this is that the image generator runs before the post content processor runs. So equation images in the problem are rendered, but not those in the feedback. That was done because of the hack of inserting the stringMaRkErfollowed by the image number hash when the image is initially inserted into the problem text, and then later replacing that with the alignment styel when the image is rendered. That results in invalid HTML whichMojo::DOMdoesn't like.To fix the issue the
MaRkErhack is reworked. Instead of that string, adata-imagegen-alignment-markerattribute is used whose value is the image number hash. Since that is valid HTML,Mojo::DOMis fine with it and leaves it as it is. So the image generator can now be run after the post content processor runs, and that renders the images in feedback as well.Care is needed for the images in feedback when the
data-imagegen-alignment-markeris replaced. Since the renderedimgtag is inside thedata-bs-contentattribute of the feedback button, it is HTML encoded. So instead of double quotes, the HTML double quote escape character (") is used.Another option would be to eliminate the "images" display mode. Clearly no one is using it, since I think this bug would have been noticed rather quickly when WeBWorK and PG 2.19 were released if anyone was using it.