Skip to content

Commit 5b19c59

Browse files
authored
Merge pull request #1063 from drgrice1/mathquill-feedback-position-update
Update feedback popover position when typing in a MathQuill input.
2 parents f4bb83d + 395deca commit 5b19c59

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

htdocs/js/MathQuill/mqeditor.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
if (input.classList.contains('incorrect')) answerQuill.classList.add('incorrect');
3737
if (input.classList.contains('partially-correct')) answerQuill.classList.add('partially-correct');
3838

39+
// Find the feedback button for this input if there is one on the page.
40+
const feedbackBtn = document.querySelector(`button[data-answer-label="${answerLabel}"`);
41+
3942
// Default options.
4043
const cfgOptions = {
4144
spaceBehavesLikeTab: true,
@@ -261,6 +264,9 @@
261264
answerQuill.input.value = '';
262265
answerQuill.latexInput.value = '';
263266
}
267+
268+
// If the feedback popover is open, then update its position.
269+
if (feedbackBtn) bootstrap.Popover.getInstance(feedbackBtn)?.update();
264270
};
265271

266272
input.after(answerQuill);

macros/PG.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,7 @@ sub ENDDOCUMENT {
12111211
);
12121212
}
12131213
)->to_string,
1214+
answer_label => $answerLabel,
12141215
bs_toggle => 'popover',
12151216
bs_trigger => 'click',
12161217
bs_placement => 'bottom',

0 commit comments

Comments
 (0)