From 7c9edc887f16da1f350dfd4ad8ca51ed410481f8 Mon Sep 17 00:00:00 2001 From: Brayan Ceron Date: Thu, 17 Sep 2026 15:37:46 -0500 Subject: [PATCH 1/2] fix: add animation frame for submitting answers after problem reset --- xblocks_contrib/problem/assets/static/js/display.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xblocks_contrib/problem/assets/static/js/display.js b/xblocks_contrib/problem/assets/static/js/display.js index e2d50837..0b852973 100644 --- a/xblocks_contrib/problem/assets/static/js/display.js +++ b/xblocks_contrib/problem/assets/static/js/display.js @@ -639,6 +639,9 @@ Problem.prototype.reset_internal = function () { that.el.trigger("contentChanged", [that.id, response.html, response]); that.render(response.html, that.scroll_to_problem_meta); that.updateProgress(response); + window.requestAnimationFrame(function () { + that.submitAnswersAndSubmitButton(); + }); return window.SR.readText(gettext("This problem has been reset.")); } else { return that.gentle_alert(response.msg); From abe19263656f0184d7297eba4881c70a575f708a Mon Sep 17 00:00:00 2001 From: Brayan Ceron Date: Thu, 17 Sep 2026 16:15:04 -0500 Subject: [PATCH 2/2] docs: add a commet to explain the change --- xblocks_contrib/problem/assets/static/js/display.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xblocks_contrib/problem/assets/static/js/display.js b/xblocks_contrib/problem/assets/static/js/display.js index 0b852973..169aa2bb 100644 --- a/xblocks_contrib/problem/assets/static/js/display.js +++ b/xblocks_contrib/problem/assets/static/js/display.js @@ -639,6 +639,11 @@ Problem.prototype.reset_internal = function () { that.el.trigger("contentChanged", [that.id, response.html, response]); that.render(response.html, that.scroll_to_problem_meta); that.updateProgress(response); + // After reset, bind() calls submitAnswersAndSubmitButton() synchronously, but + // browsers cache the checked state of new inputs by name/id before repainting + // so :checked still returns true on fresh inputs and the button stays enabled. + // requestAnimationFrame defers the check until after the repaint, when the + // stale form state is gone and the button is correctly disabled. window.requestAnimationFrame(function () { that.submitAnswersAndSubmitButton(); });