fasthtml icon indicating copy to clipboard operation
fasthtml copied to clipboard

[BUG] Toasts inserted at bottom of page

Open comhar opened this issue 8 months ago • 0 comments

Describe the bug Toasts are being added to the bottom of the page.

Minimal Reproducible Example

from fasthtml.common import *

app, rt = fast_app()
setup_toasts(app)

@rt("/toast1")
def toast(sess): add_toast(sess, "Success!", "success")

@rt("/toast2")
def toast(sess): add_toast(sess, "Error!", "error")

@rt("/")
def index(session):
    add_toast(session, "Successful Page Load!", "success")
    add_toast(session, "Failed Page Load", "error")
    return Titled(
        "Hello World",
        P("Welcome to my first FastHTML app!"),
        Button("Continue", hx_get='/toast1', hx_swap='none'),
        Button("Cancel", hx_get='/toast2', hx_swap='none'),
    )

serve()

Expected behavior Toasts should be added to the top of the page. This only occurs for toasts that are created before a full page load.

Environment Information Please provide the following version information:

  • fastlite version: 0.1.3
  • fastcore version: 1.8.0
  • fasthtml version: 0.12.9

Confirmation Please confirm the following:

  • [x] I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
  • [x] I have provided a minimal reproducible example
  • [x] I have included the versions of fastlite, fastcore, and fasthtml
  • [x] I understand that this is a volunteer open source project with no commercial support.

Additional context N/A

Screenshots

https://github.com/user-attachments/assets/dc64f9c4-c4c5-4d86-b6d1-cce6c19b69f9

comhar avatar Apr 04 '25 17:04 comhar