Repository navigation
Warn authors when a QTI question has more than 5 options - #6356
Conversation
398d93f to
9cd46da
Compare
60479c4 to
1ea59fb
Compare
| * it announces its messages itself. | ||
| */ | ||
| alert: { | ||
| announce: { |
There was a problem hiding this comment.
Let's keep the alert prop and gate warnings on it (props.warning && props.alert), with its doc comment updated to cover warnings. Renaming it pulls the gap match, inline choice and EditableChipList callers into this PR when none of them need to change.
There was a problem hiding this comment.
Done: alert is back, documented for warnings too, and announceWarning checks props.warning && props.alert. All 8 :announce callers (gap match ×2, inline choice editor ×2, InlineChoiceOptions ×3, EditableChipList ×1) are back to :alert, so gap match, inline choice Editor.vue and EditableChipList no longer appear in the diff.
Written by rtibblesbot, an LLM-based coding agent.
| import { onBeforeUnmount } from 'vue'; | ||
| import useKLiveRegion from 'kolibri-design-system/lib/composables/useKLiveRegion'; | ||
|
|
||
| // KDS writes each message over the live region's text, so a message sent in the |
There was a problem hiding this comment.
Could you please drop this composable and go back to calling sendPoliteMessage directly in ValidationMessage, EditableChipList and InlineChoiceOptions? Messages in the same tick overwriting each other is a KDS limitation that already exists and affects every caller, so let's open a KDS issue about queuing messages in useKLiveRegion rather than working around it here.
There was a problem hiding this comment.
Dropped useAnnouncePolitely; its 3 callers (ValidationMessage, EditableChipList, InlineChoiceOptions) call sendPoliteMessage directly again, and EditableChipList is back to its unstable version. Drafted a KDS issue asking useKLiveRegion to queue messages sent together.
Two changes remain that time a warning against focus, not against other messages:
InlineChoiceOptions: when Add option brings the 6th option, the warning is sent afteraddOptionfocuses the new field instead of before it.- New
useWarningOnFocus, used by choice, ordering, associate and match: an Add that brings up the too-many warning sets:alert="false"on it and sends it on the section's nextfocusin, or after a frame if none lands. Tiptap focuses the new editor after a timeout and a frame, and a screen reader's focus announcement cuts off a message read before it.
Written by rtibblesbot, an LLM-based coding agent.
| // KDS writes to `window.politeRegionEl`, clearing it 350ms later; a fresh one per test | ||
| // keeps an earlier test's clear from emptying it. | ||
| beforeEach(() => { | ||
| window.politeRegionEl = document.createElement('div'); |
There was a problem hiding this comment.
Without the queue, could you please mock useKLiveRegion here and in the match spec, as the other QTI specs do, rather than replacing window.politeRegionEl? The nextFrame() waits added to the existing specs and the batching tests in ValidationMessage.spec.js can go too. A test that a warning with alert set to false isn't announced would cover the new check.
There was a problem hiding this comment.
Done: associate and match specs mock useKLiveRegion and assert on sendPoliteMessage, including which element has focus when the warning is sent. Removed every nextFrame() / requestAnimationFrame wait this PR added to the specs (choice, ordering, inline choice, EditableChipList, associate, match); the two that predate it stay. useWarningOnFocus.spec.js runs its frame fallback with Jest fake timers. ValidationMessage.spec.js now has only two tests: a warning is announced, and a warning with alert false isn't.
Written by rtibblesbot, an LLM-based coding agent.
1ea59fb to
5ffcdd4
Compare
b18a613 to
7ee4fc2
Compare
| * the `focus` command), and a screen reader's focus announcement cuts off a message read | ||
| * out before it. | ||
| */ | ||
| export function useWarningOnFocus(warning) { |
There was a problem hiding this comment.
Could you please drop useWarningOnFocus and let these warnings announce on mount through ValidationMessage, the same way as the single-option warning? It relies on Tiptap's internal focus timing, and it spreads held state, focusin handlers and Add wrappers across four editors. If focus cutting off a warning turns out to be a problem with a real screen reader, it would affect every warning, so let's handle it in a separate issue.
There was a problem hiding this comment.
Dropped useWarningOnFocus; every too-many warning now announces on mount through ValidationMessage, like the single-option warning.
- Searched the branch for announcements held until focus lands: 5 sites matched, all changed.
- Choice, ordering, associate and match editors:
focusinhandlers, held state and Add wrappers removed. InlineChoiceOptions: removedpendingAnnouncement, which held the panel's messages until the added option took focus; it announces straight away again, as onunstable.
- Choice, ordering, associate and match editors:
- The "read once it takes focus" tests now assert the warning shows and is announced on add.
Written by rtibblesbot, an LLM-based coding agent.
- Choice, ordering, associate, match and inline choice editors show a non-blocking warning past 5 options, pairs, rows or distractors - ValidationMessage's `alert` prop now gates announcing warnings too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7ee4fc2 to
ea2347f
Compare
b296b45
into
learningequality:unstable
|
Quick check on rtibblesbot's work on this PR: react 👍 helpful · 😕 mixed · 👎 not helpful. Reply with anything specific. |
|
QA Steps Lists with more than 5 entries now show a warning. It doesn't block saving.
🤖 This comment was posted by Claude under my supervision, to find the PRs that needed QA and to review the steps QA should test. |
|
Implemented as specified. |
Summary
References
Closes #6345. Related: #6316.
Reviewer guidance
Suggested review: Light-touch code review, then manual QA.
Engineer review
Engineer evidence
Not tested with a real screen reader.
QA review
Manual QA steps
QA team: the question editor warns when a list has more than 5 entries. Regressions are most probable in screen reader announcements and after a "Response type" change.
Open an exercise you can edit. Click "NEW QUESTION" in its "QUESTIONS" tab for each item.
Captures (13)
Associate and match
Warning and duplicate error are each announced; neither replaces the other.
Choice and ordering
multiple-select-add-6th-7th-remove.webm
Inline choice
s3-inline-choice-add-6th-7th-remove.webm
Change question type
s4-convert-single-to-multi-and-ordering.webm
s4-convert-match-to-associate-and-back.webm
AI usage
Claude Code wrote the code and tests; verified with Jest and screenshots.
Written by rtibblesbot, an LLM-based coding agent.
🟡 Waiting for feedback
WAITING · for reviewLast updated: 2026-11-25 00:37 UTC