fix: read the prompt container by class, not by the id pie-lib removed PIE-927 - #3103
Merged
Conversation
…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
)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://illuminate.atlassian.net/browse/PIE-927