diff --git a/htdocs/js/MathQuill/mqeditor.js b/htdocs/js/MathQuill/mqeditor.js index 4ce405809..53b3356bd 100644 --- a/htdocs/js/MathQuill/mqeditor.js +++ b/htdocs/js/MathQuill/mqeditor.js @@ -36,6 +36,9 @@ if (input.classList.contains('incorrect')) answerQuill.classList.add('incorrect'); if (input.classList.contains('partially-correct')) answerQuill.classList.add('partially-correct'); + // Find the feedback button for this input if there is one on the page. + const feedbackBtn = document.querySelector(`button[data-answer-label="${answerLabel}"`); + // Default options. const cfgOptions = { spaceBehavesLikeTab: true, @@ -261,6 +264,9 @@ answerQuill.input.value = ''; answerQuill.latexInput.value = ''; } + + // If the feedback popover is open, then update its position. + if (feedbackBtn) bootstrap.Popover.getInstance(feedbackBtn)?.update(); }; input.after(answerQuill); diff --git a/macros/PG.pl b/macros/PG.pl index 2037f1de8..61a478a2a 100644 --- a/macros/PG.pl +++ b/macros/PG.pl @@ -1211,6 +1211,7 @@ sub ENDDOCUMENT { ); } )->to_string, + answer_label => $answerLabel, bs_toggle => 'popover', bs_trigger => 'click', bs_placement => 'bottom',