Skip to content

Fix MCQ validation, styling, consistency, and add multi-group support#271

Open
elasticsounds wants to merge 3 commits intomainfrom
elasticsounds/fix-mcq-generation
Open

Fix MCQ validation, styling, consistency, and add multi-group support#271
elasticsounds wants to merge 3 commits intomainfrom
elasticsounds/fix-mcq-generation

Conversation

@elasticsounds
Copy link
Copy Markdown
Contributor

Summary

  • Fix answer validation bug where string "false" was treated as truthy, causing all options to show as correct
  • Replace destructive className replacement (setLetterAppearance) with non-destructive classList toggling (setOptionState) to prevent layout instability when selecting/validating options
  • Add self-healing JS that auto-patches missing .activity-option classes and role="radiogroup" attributes on LLM-generated HTML
  • Simplify MCQ prompt to a minimal functional skeleton, giving the LLM creative freedom on non-interactive elements while locking down required interactive structure
  • Add cross-page visual consistency pass: a second LLM call rewrites subsequent activity sections to match the first section's styling
  • Add accessible feedback display with opaque bg-white background for WCAG AA contrast compliance
  • Support multiple question groups per page with per-group selection tracking, validation, and localStorage persistence
  • Extract side effects (sound, email, attempt counter) into recordAttemptResult so they fire once per submit, not once per group

Test plan

  • Generate MCQ pages and verify correct/incorrect feedback displays properly
  • Verify radio button selection doesn't cause layout shifts
  • Generate multi-section MCQ pages and verify visual consistency across sections
  • Test pages with multiple question groups — each group should track independently
  • Verify keyboard shortcuts (1-9) work on single-group pages and are disabled on multi-group pages
  • Check feedback text contrast on various background colors

… support

- Fix answer validation using strict boolean comparison instead of truthy check
- Replace destructive className replacement with non-destructive classList toggling
- Add self-healing for missing .activity-option and role="radiogroup" attributes
- Add cross-page visual consistency pass via second LLM call
- Simplify MCQ prompt to functional skeleton, giving LLM creative freedom
- Add accessible feedback with opaque bg-white for WCAG AA contrast
- Support multiple question groups per page with per-group tracking
- Extract side effects into recordAttemptResult to fire once per submit
…, and localStorage restore fix

- Add question structure analysis step to MCQ prompt so the LLM correctly
  identifies image-pair activities as N/2 independent binary-choice questions
  rather than 1 question with N options
- Add image card option guidance for side-by-side binary comparison layout
- Allow partial submission in multi-group mode: unanswered groups show the
  correct answer instead of blocking submit entirely
- Fix localStorage restore bug: move restorePreviousSelection after the
  clone-to-remove-listeners step so selectedByGroup references point to
  live DOM nodes, not detached ones
- Clarify multi-group answer generation in answer prompt
- Replace showFeedback (text in feedback-container) with showResultMark
  (✓/✗ badge overlaid on each option) for universal visual feedback
- Add showInlineSummary banner at bottom of activity section with
  score display (e.g. "3 / 4") and try-again/correct messaging
- Banner uses role="status" and aria-live="polite" for screen reader
  accessibility, stays visible until user changes a selection
- Keep toast suppressed for MCQ — inline banner replaces it
- Simplify cleanup functions to remove badges and banners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant