Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dragging Slider in Experimental Layout works, but not when again wrapped into @htl #284

Open
schlichtanders opened this issue Jan 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@schlichtanders
Copy link

Hi there, consider the following example

using PlutoUI, HypertextLiteral

# --------------------

ui_n = @bind x Slider(1:10)

# --------------------

y = 2x

# --------------------

experimental_layout = PlutoUI.ExperimentalLayout.Div([PlutoUI.ExperimentalLayout.Div(@htl "x = $ui_n"), PlutoUI.ExperimentalLayout.Div(@htl "y = 2x = $y")], style="display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));")

# --------------------

@htl "$experimental_layout"

While dragging the slider in the experimental_layout cell works, it does freeze constantly when used in the @htl "$experimental_layout" cell.

Does someone know the reason and whether there is some way to circumvent this? It would be great if PlutoUI.ExperimentalLayout.Div could be used as part of an outer @htl context.

@fonsp
Copy link
Member

fonsp commented Feb 1, 2024

Interesting! Originally, PlutoUI.ExperimentalLayout.Div would only work when it was used all the way to the top, i.e. the Div must be the object returned by the cell, or its chain of parents is.

When wrapped inside @htl, I believe that we use embed_display (JuliaPluto/AbstractPlutoDingetjes.jl#9) to make it work. So there must be an issue in the embed_display mechanism. It's also possible that we just render HTML in this case. You can check the browser devtools which is the case.

@fonsp fonsp added the bug Something isn't working label Feb 1, 2024
@fonsp
Copy link
Member

fonsp commented Feb 1, 2024

But note that you only get the full benefits of experimentallayout (like partial re-rendering) if you return it directly from a cell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants