Skip to content

fix(render-ui)!: scope PreviewPrompt to its own node instead of a shared id PIE-927 - #2312

Merged
CarlaCostea merged 1 commit into
developfrom
fix/PIE-927
Aug 20, 2026
Merged

fix(render-ui)!: scope PreviewPrompt to its own node instead of a shared id PIE-927#2312
CarlaCostea merged 1 commit into
developfrom
fix/PIE-927

Conversation

@CarlaCostea

Copy link
Copy Markdown
Contributor

https://illuminate.atlassian.net/browse/PIE-927

PreviewPrompt located its own DOM node by searching the whole document for #preview-prompt, but every prompt on a page emitted that same id. getElementById returns the first match, so on a 5-item page 28 of 30 typeset requests resolved to item 1's prompt and items 2-5 were never typeset at all. querySelectorAll returns every match, so each instance additionally re-aligned every other prompt's images, making that work O(N^2) in item count.

Both lookups now read a ref to the component's own container and can no longer escape the instance's subtree. The hardcoded id is removed: duplicate ids in one document are invalid HTML and break aria-labelledby / aria-describedby and label-for wiring. A stable preview-prompt class replaces it as the hook for "is this node inside a prompt" checks, which is a kind test rather than an identity one.

No replacement id is needed. Where the prompt genuinely labels a groNo replacement id is nnatively, rendered as a inside

, and nothing in pie-lib or pie-elements points an aria id-reference at it.

BREAKING CHANGE: PreviewPrompt no longer renders id="preview-prompt". Consumers matching on that id must match the .preview-prompt class instead, e.g. audio.closest('#preview-prompt') becomes audio.closest('.preview-prompt'). Affects 5 pie-elements packages: multiple-choice, categorize, drag-in-the-blank, hotspot, image-cloze-association.

…red id PIE-927

PreviewPrompt located its own DOM node by searching the whole document for
#preview-prompt, but every prompt on a page emitted that same id. getElementById
returns the first match, so on a 5-item page 28 of 30 typeset requests resolved
to item 1's prompt and items 2-5 were never typeset at all. querySelectorAll
returns every match, so each instance additionally re-aligned every other
prompt's images, making that work O(N^2) in item count.

Both lookups now read a ref to the component's own container and can no longer
escape the instance's subtree. The hardcoded id is removed: duplicate ids in one
document are invalid HTML and break aria-labelledby / aria-describedby and
label-for wiring. A stable `preview-prompt` class replaces it as the hook for
"is this node inside a prompt" checks, which is a kind test rather than an
identity one.

No replacement id is needed. Where the prompt genuinely labels a groNo replacement id is nnatively, rendered as a <legend> inside <fieldset>, and nothing in
pie-lib or pie-elements points an aria id-reference at it.

BREAKING CHANGE: PreviewPrompt no longer renders id="preview-prompt". Consumers
matching on that id must match the `.preview-prompt` class instead, e.g.
audio.closest('#preview-prompt') becomes audio.closest('.preview-prompt').
Affects 5 pie-elements packages: multiple-choice, categorize, drag-in-the-blank,
hotspot, image-cloze-association.
@CarlaCostea
CarlaCostea merged commit 01555f4 into develop Aug 20, 2026
4 checks passed
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