Skip to content

Conversation

@sergeleger
Copy link
Collaborator

@sergeleger sergeleger commented Dec 23, 2025

PR Goal?

This PR fixes the clipping of tall images, which sometimes occurs when text column of the read along is narrow.

The applied changes are to properly implement HTML nesting rules and CSS Grid rules which lets the browser infer width and height information on the parent container of the image.

  • HTML nesting rules states that inline elements like <span /> cannot contain block elements like <div />. The <img /> tag had that hierarchy (html > body > ... > div > span > div > img)

  • CSS Grid rules requires that grid cells must be defined directly underneath the grid parent container, here's an incorrect implementation:

<div style="display: grid">
   <div> <!-- introduces a layer between grid parent and child -->
         <div style="grid-area: image"> ... </div>
   </div>
</div>

Correcting both issues seems to have corrected the tall image clipping problem.

Fixes?

Closes #468

Feedback sought?

Validate my assumptions. I'm also not familiar with other ReadAlongs UI design decisions that this solution breaks.

Priority?

Medium, but it is a bug reported by users.

Tests added?

No, but tests still passes after restructuring the HTML.

How to test?

To recreate the broken behavior (in production for example):

  • create a new read along with a single short sentence (e.g.: this is a test)
  • upload the image shared by Del (in issue Studio-W: during the Studio tour incorrect preview shown to user #428)
  • notice the bottom of the image is truncated
  • add a new translation for "this is a test" and type in a lot of translation text forcing the text grid to get wider and the image will eventually resize so that it is no longer clipped.

With this fix:

Confidence?

Medium. As mentioned above, this seems to work but have I introduced breaking UI look and feel.

Version change?

@sergeleger sergeleger linked an issue Dec 23, 2025 that may be closed by this pull request
@semanticdiff-com
Copy link

semanticdiff-com bot commented Dec 23, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  packages/studio-web/src/assets/bundle.js  100% smaller
  packages/web-component/src/components/read-along-component/read-along.tsx  44% smaller

@sergeleger sergeleger requested a review from deltork December 23, 2025 15:21
@github-actions
Copy link
Contributor

PR Preview Action v1.6.3

🚀 View preview at
https://ReadAlongs.github.io/Studio-Web/pr-preview/pr-501/

Built to branch gh-pages at 2025-12-23 15:25 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@sergeleger sergeleger requested a review from joanise December 23, 2025 15:28
Copy link
Collaborator

@deltork deltork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me!
You can move the icon to the top left by setting the margin of #img-remover to 0

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.

Title page image style needs to be adjusted

3 participants