"Shift due dates" CTA under a past-due problem does nothing — onclick is invalid JavaScript
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- django, javascript, python
- Ambito
- frontend
Direzione di ricerca
Inizia in xblocks_contrib/problem/capa/templates/problem.html, nel CTA di invio disabilitato intorno alla riga 69, quindi confrontalo con il banner verticale funzionante e ispeziona emit_event. Riproduci il flusso di un problema scaduto in un corso autogestito con date relative e verifica che facendo clic sul CTA venga inviato l’evento previsto senza un errore di sintassi nel browser.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[!NOTE]
This issue was written by Claude (Claude Code). The investigation was driven by me — I hit the bug in a live environment and directed the diagnosis; Claude traced the provenance and drafted the write-up, which I reviewed before posting.
Summary
The "Shift due dates" call-to-action rendered beneath a past-due problem does nothing when clicked: no request, no toast, no state change. Its onclick attribute is not valid JavaScript, so the handler never runs.
xblocks_contrib/problem/capa/templates/problem.html, line 69 (current main, and released in xblocks-contrib 0.17.0):
<button class="submit-cta-link-button btn-link btn-small"
onclick="emit_event('{{ submit_disabled_cta.event_data }}')">
submit_disabled_cta.event_data is a Python dict, whose repr uses single quotes. Wrapping the interpolation in single quotes means the first ' of the payload terminates the string literal that the template's own ' opened, so the browser sees:
emit_event('{'event_name': 'post_event', 'post_data': { ... }}')
// ^^^ string "{" followed by the identifier `event_name`
which fails to parse:
SyntaxError: missing ) after argument list
Expected
Clicking the CTA should postMessage the event to the parent frame — the same behaviour as the equivalent banner in the vertical/unit view, which the Learning MFE receives and turns into a reset_course_deadlines POST plus a confirmation toast.
How it happened
The Mako original was correct — openedx-platform, lms/templates/problem.html:61:
onclick="emit_event(${submit_disabled_cta['event_data']})"
The quotes were introduced when that template was converted to a Django template, in openedx-platform commit 99c6e901d9 — "Convert Problem Block Mako Templates to Django Templates (openedx/openedx-platform#37570)". The file later moved to xmodule/capa/templates/problem.html, was removed from openedx-platform by cd733fee2f ("refactor: Remove capa folders (openedx/openedx-platform#38045)"), and was carried into this repo verbatim by #63.
The sibling CTA in openedx-platform's lms/templates/vert_module.html:45 was not part of that conversion and is still Mako:
onclick="emit_event(${vertical_banner_cta['event_data']})"
It works correctly today, which is why the unit-level banner shifts dates while the problem-level CTA does nothing. Both get their payload from the same builder, openedx/features/personalized_learner_schedules/call_to_action.py.
Suggested fix
Drop the two quote characters:
- onclick="emit_event('{{ submit_disabled_cta.event_data }}')">
+ onclick="emit_event({{ submit_disabled_cta.event_data }})">
Django autoescapes the repr's ' to ', but HTML decodes character references in attribute values before the JavaScript is parsed, so the unquoted form works as-is; |safe would be a legibility choice rather than a requirement.
Line 94 of the same template is the non-MFE fallback (a real form submit, no onclick) and is unaffected.
Reproduction
- A self-paced course with Personalized Learner Schedules active (
course_experience.relative_dates), containing a graded problem with a relative due date. - Backdate the learner's
Schedule.start_dateso that due date is in the past. - Open the unit in the Learning MFE.
- The unit-level banner's "Shift due dates" button works: toast, and the dates shift.
- The "Shift due dates" button rendered under the past-due problem does nothing; the console logs
Uncaught SyntaxError: missing ) after argument list.
Environment: xblocks-contrib 0.17.0, Tutor dev (openedx-dev:21.0.7-main), frontend-app-learning on master. The same line is present on this repo's main.
Impact
Minor and non-blocking — a learner can still shift dates from the unit banner, the Dates tab, or the course outline.
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 16
- Merge medio
- 5h 30m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openedx/xblocks-core
-
ChoiceTextResponse: a submission that omits a required numtolerance_input key is graded correctAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
openedx/xblocks-core#306 ·
-
WCAG - Question Content Not Programmatically Associated With Answer ChoicesForse di nuovo libera @jesusbalderramawgu l’ha presa 40 giorni fa e non c’è nessuna pull request aperta. Aperta
openedx/xblocks-core#300 · 1 assegnatario ·
-
Flaky VideoBlock JS testsApertaflaky-test
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
openedx/xblocks-core#290 · 2 commenti ·
-
[DEPR]: Remove Video Bumper (pre-roll video) featureForse di nuovo libera @feanil l’ha presa 71 giorni fa e non c’è nessuna pull request aperta. Apertadepr
openedx/xblocks-core#284 · 1 reazione · 2 assegnatari ·
-
Video Block ImprovementsForse di nuovo libera @farhan l’ha presa 105 giorni fa e non c’è nessuna pull request aperta. Apertaepic maintenance
openedx/xblocks-core#276 · 1 assegnatario ·
Tutte le issue di openedx/xblocks-core
Issue simili
-
comp/tools P2 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NousResearch/hermes-agent#142908 · 1 commento ·
-
[oblt-aw][autodoc] Fix malformed headings in new Buildkite docs pagesForse già presa @github-actions l’ha presa oggi. Apertadocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: fileUploadMatrix.test.ts URL case does a real DNS lookup and fails offlineForse già presa @r2jaff l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ComposioHQ/composio#5054 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
pytorch/tensordict#3286 ·
I maintainer di solito rispondono entro 1 giorno