Conversation
|
Thanks for the pull request, @bra-i-am! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
4f512f6 to
abe1926
Compare
Fixes a timing bug where the Submit button remained enabled after clicking Reset on CAPA problems (SCQ, MCQ, and others).
When
reset_internalreceives the server response it callsrender(response.html), which replaces the problem DOM via jQuery's.html(). The new HTML has no checked inputs, but browsers cache the checked state of form controls byname/idacross a DOM replacement — so immediately after the swap:checkedstill returnstrueon the fresh inputs before the browser repaints.bind()runs synchronously insiderender()and callssubmitAnswersAndSubmitButton()right away; that function finds the inputs "checked" (stale cache), setsanswered = true, and leaves the Submit button enabled.The fix wraps a second
submitAnswersAndSubmitButton()call inwindow.requestAnimationFrame, which defers execution until after the browser has painted the new frame. By that point the stale form state is cleared,:checkedcorrectly returnsfalsefor all inputs, and the Submit button is disabled as expected.Closes openedx/openedx-platform#36824
Testing instructions
Screencast
Screencast.from.17-09-26.15.39.26.webm
Screencast.from.17-09-26.15.39.02.webm