…d PIE-927
pie-lib's PreviewPrompt no longer renders id="preview-prompt" on its container. Every
prompt on a page emitted that same id, so the id was invalid HTML wherever a page carried
more than one prompt -- it broke aria-labelledby / aria-describedby and label-for
wiring, and it broke the document-wide getElementById lookup PreviewPrompt itself read it
back through: on a five-item page 28 of 30 typeset requests resolved to item 1's prompt and
items 2-5 were never typeset. The component now finds its own node via a ref, and the
container carries a stable preview-prompt class in place of the id. A class is the
supported hook for "is this node inside a prompt", precisely because it stays valid when a
page renders many prompts.
The ten audio.closest('#preview-prompt') call sites move to .preview-prompt:
multiple-choice, categorize, drag-in-the-blank, hotspot and
image-cloze-association, two eachimage-cloze-association, two eachimage-cloze-association, two eachimage-cloze-association, two eachimage-cloze-
mage-cloze-association, two eachimage-cloze-association, two eachimage-cloecked rathermage-cloze-association, two eachimage-cloze-association, two eachimage-cloecked rathermar pmage-cloze-association, two eachimage-cloze-association, two eachimage-cloeckidePrompt return
skips the autoplay toast wiring entirely, so prompt audio never plays in Safarskips the autoplay toast wiring entirely, so prompt audio never plays in Safarskips to sitting outside a
prompt, and behave as intended in all five packages.
No test mock needed the class: none of the existing tests reach closest().
multiple-choice calls isComplete with one argument, so the audio gate is never entered;
hotspot and image-cloze-association replace the element with a stub via
jest.mock('../index'); categorize and drag-in-the-blank have no audio coverage at all.
The data-testid=preview-prompt mocks are a different attribute and are left alone.
.preview-prompt only exists in the new @pie-lib/render-ui, so this cannot land on its own
-- flipping the selectors against 6.1.3 breaks prompt-audio detection exactly as leaving
them breaks it against the new version.
EOF
)
https://illuminate.atlassian.net/browse/PIE-927