Add width and height to .jspsych-content for percentage-based plugin dimensions #3618
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.
Problem
The
.jspsych-contentelement lacked explicit width and height properties, preventing plugins from using percentage-based dimensions likeheight: 100%to fill the display element. When plugin authors tried to use these CSS properties, they would collapse to zero height/width because the parent element had no defined size.This forced plugin developers to either:
100vhwhich don't respect the display element boundariesSolution
Added
width: 100%andheight: 100%to the.jspsych-contentCSS class insrc/index.scss:This minimal change allows
.jspsych-contentto fill its parent.jspsych-content-wrapper(which hasflex: 1 1 100%andwidth: 100%), enabling child elements to properly calculate percentage-based dimensions.Impact
Before this change:
After this change:
Backward Compatibility
This change is fully backward-compatible:
Testing
tests/core/display-element-sizing.test.tsto verify DOM structure with and without progress barCloses #3285
Original prompt
Fixes #3617
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.