quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.63k stars 296 forks source link

Quarto Dashboard - Observable Plot Legend on Mobile Issue #7543

Open tashapiro opened 8 months ago

tashapiro commented 8 months ago

Bug description

Testing the latest Quarto Dash format with ojs code chunks. I have a repository that includes some example dashboards.

I noticed on mobile, for Observable Plots that include a legend, there is a height scaling issue (keeps elongating). This might be specific to Plots within a card component (have not tested it outside).

Link to dashboard: https://tashapiro.github.io/intro-observable/dashboard/dashboard.html Link to repo: https://github.com/tashapiro/intro-observable/tree/main/dashboard

Including screenshots for reference.

Desktop version is fine:

Screenshot 2023-11-10 at 9 34 32 AM

On mobile, or smaller screens, the plot height starts skewing:

Screenshot 2023-11-10 at 9 34 38 AM

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Your environment

No response

Quarto check output

No response

cscheid commented 8 months ago

Thanks for the report! I've a hunch about what's happening. We try to be clever with sizing Plot.plot() calls, by automatically injecting a reactive that sets its width and height to be that of the surrounding card. Can you try adding width: undefined and height: undefined to the plot that's rendering wrongly? That will turn off our smart auto-sizing (but will mean your plots will not be responsive as you resize the cards, etc)

dragonstyle commented 5 months ago

It is probably some form of interaction between that auto-sizing and our grid, which convert the row size to the following in responsive mode:

.quarto-dashboard .bslib-grid {
    grid-template-rows: minmax(1em, max-content) !important;
}

I have a feeling the re-computation results in a new height, which then results in a new content size, and so on. Not sure the best way to interrupt the cycle here...