Skip to content

Commit 0742c85

Browse files
committed
Don't automatically show warnings as soon as they're made
fixes #1135 Previously, the warning message pop up was shown as soon as any warning was created. The only way for this to happen when you don't have an input focused is as a result of submitting the part. It's very easy for the warning box to overlap the part feedback or other parts of the prompt. In gap-fill parts, there can be so many boxes that almost the entire part is covered. This changes the logic so that warnings are only shown when you focus an input element. "Invalid input" warnings are usually repeated as "fail" feedback messages, so the student will still see why their answer was invalid after submitting.
1 parent 7a72533 commit 0742c85

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

‎runtime/scripts/part.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,7 @@ if(res) { \
10131013
this.stagedAnswer = answer;
10141014
this.setDirty(true);
10151015
this.removeWarnings();
1016+
this.display && this.display.showWarnings();
10161017

10171018
if(!dontStore) {
10181019
if(!this.question || !this.question.exam || !this.question.exam.loading) {

‎themes/default/files/scripts/part-display.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,6 @@ Numbas.queueScript('part-display',['display-util', 'display-base','util','jme'],
674674
warning: function(warning)
675675
{
676676
this.warnings.push({message:warning+''});
677-
this.showWarnings();
678677
},
679678
/** Set the list of warnings.
680679
*
@@ -683,9 +682,6 @@ Numbas.queueScript('part-display',['display-util', 'display-base','util','jme'],
683682
*/
684683
setWarnings: function(warnings) {
685684
this.warnings(warnings.map(function(warning){return {message: warning+''}}));
686-
if(warnings.length) {
687-
this.showWarnings();
688-
}
689685
},
690686
/** Remove all previously displayed warnings.
691687
*

0 commit comments

Comments
 (0)