iframe widths (at least for Desmos)

36 views
Skip to first unread message

Oscar Levin

unread,
May 16, 2025, 1:42:36 PM5/16/25
to PreTeXt development
There seems to be a bug with setting the width of an iframe for a desmos activity (maybe other things).  If you set width=100%, the iframe width is still being set to a number of pixels that does not fill up the available width of the parent.  

Maybe this would be as easy as setting the width of the iframe equal to the width of the interactive?  Not sure exactly how the aspect ratio comes into play.  Mostly just posting this now (from our workshop) so we don't forget.

Rob Beezer

unread,
May 16, 2025, 5:48:36 PM5/16/25
to prete...@googlegroups.com
Is this a case where we are using the "design width" of 600 pixels, and now that
constant is being relaxed/violated by a theme that allows wide widgets?
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/023877f3-ddef-4812-9e98-9fb2ac282389n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/023877f3-
> ddef-4812-9e98-9fb2ac282389n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Andrew Scholer

unread,
May 16, 2025, 7:59:20 PM5/16/25
to prete...@googlegroups.com
Yes, that is the cause.

For HTML builds, we could explore outputting the raw percent and aspect ratio instead of trying to produce pixel sizing.

To play with this, use browser dev tools to remove the width/height that currently are on the iframe and then add some styles like:
    aspect-ratio: 3/2;
    width: 100%;

Andrew Scholer (he/him/his)
Computer Science Instructor
Chemeketa Community College


To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDAxNS5iZWV6ZXI.1747432114%40pnsh.

Oscar Levin

unread,
Feb 19, 2026, 3:44:01 PM (11 days ago) Feb 19
to PreTeXt development
This came up again today in drop-in when Chrissy showed a doenet activity that became useless when an answer drove the box to be too wide for the iframe.  Half of the solution is for Doenet to change their css to make overflow-x be auto.  But in the runestone assignment page, there is lots of extra space and letting the interactive have a wider width would be very useful.  

I could PR a change that sets the width for any iframe to 100% rather than 600px, but I'm not sure if that will mess up the recent resizing efforts (which I think just addressed height).

Andrew Scholer

unread,
Feb 19, 2026, 5:24:16 PM (11 days ago) Feb 19
to prete...@googlegroups.com
Any idea if the content has been built since the layout changes to interactives went live? I think those changes just hit the CLI this week. And I think they might fix this. Or at least change the fixes needed.

Which reminds me... now that they are merged I should do an announcement.

I would be happy to look into this. Oscar - if you or Chrissy could get me a concrete example that would be handy.

Andrew


Chrissy Safranski

unread,
Feb 19, 2026, 9:23:36 PM (11 days ago) Feb 19
to PreTeXt development
I have rebuilt a couple times this week, including today, but I don't know what version of the CLI the Runestone author server is running.  Since this project is experimental, the book is not browsable on Runestone unless you wanted to enroll as a student in testdoenetcourse.

Matt has a website version that was built 6 days ago.  You can see the problematic behavior in part d of this problem (there's also an error in that answer that has been fixed but not rebuilt there yet): https://mattboelkins.github.io/active-calculus-single-mbx/doenet/sec-2-3-prod-quot.html#ez-2-3-doenet-3

Even though the Runestone assignment page has more horizontal real estate, the Doenet interactives stay the same width as they are in-context, even after the rebuild today.

Chrissy

Andrew Scholer

unread,
Feb 20, 2026, 10:37:51 AM (11 days ago) Feb 20
to prete...@googlegroups.com
Chrissy - 

According to the log on a build I just did, RS is on CLI 2.36.0. That uses a version of PreTeXt core from before the interactive update. (You can use Show last Log after building to check.)

I believe Brad updates PreTeXt as part of regular weekend maintenance. So either try again next week or do a local test with 2.37+.

If there are still issues at that point, please point me to a self-contained minimal sample I can test on.

Chrissy Safranski

unread,
Feb 20, 2026, 1:54:01 PM (10 days ago) Feb 20
to PreTeXt development
I did a local build using 2.37.1 and still see the same issue.

It wouldn't surprise me if the rest of the fix has to come from a change within Doenet.  The interactive is located inside the dynamic part of an exercise, in a non-Salem theme.  It starts off with a width that fits.  As readers type in the answer box and the answer box grows, what happens when it gets too wide for its containers?

Chrissy

Andrew Scholer

unread,
Feb 20, 2026, 4:25:02 PM (10 days ago) Feb 20
to prete...@googlegroups.com
Yes, it sounds like Doenet will need to handle that situation.

If someone working on the CSS on their side wants to chat, feel free to put them in touch with me.

Andrew

Duane Nykamp

unread,
Feb 21, 2026, 11:48:28 AM (10 days ago) Feb 21
to PreTeXt development
I implemented Oscar's suggestion of adding `overflow-x: auto;` to the Doenet container. Chrissy confirmed that this change fixed the problem.

(The fix is not yet available in the latest Doenet release. One has to specify `version="dev"` on the interactive to get the fix for now.)

Duane

Reply all
Reply to author
Forward
0 new messages