https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • h

    hundreds-camera-24900

    10/28/2022, 5:02 PM
    Nice, I'm not sure I remember why I wanted that but I bet I can think of something
  • b

    bland-coat-6833

    10/28/2022, 6:31 PM
    Dragging this up from the archives now that we have a meme channel.
  • b

    brainy-ice-92385

    10/28/2022, 6:53 PM
    Thanks!! this has been requested enough that it's worth a PR. Not your workaround but a real config option. Though @mysterious-toddler-20573 I wonder if it's worth trying to include this logic in head-swap since.... ya know... title is head
  • m

    mysterious-toddler-20573

    10/28/2022, 6:53 PM
    there should at least be an event
  • m

    mysterious-toddler-20573

    10/28/2022, 6:53 PM
    that you can preventDefaut on
  • m

    mysterious-toddler-20573

    10/28/2022, 6:54 PM
    PR welcome
  • m

    mysterious-toddler-20573

    10/28/2022, 6:54 PM
    config option is good too
  • m

    mysterious-toddler-20573

    10/28/2022, 6:54 PM
    why not both?
  • b

    brainy-ice-92385

    10/28/2022, 6:56 PM
    I don't grok the event flow immediately, but I can work on the config
  • m

    mysterious-toddler-20573

    10/28/2022, 7:01 PM
    roger roger
  • s

    silly-soccer-20915

    10/28/2022, 9:15 PM
    @brainy-ice-92385 config option where if I may ask? in the htmx.config? or within the hx-swap?
  • m

    miniature-lizard-24702

    10/28/2022, 9:15 PM
    damn that gif hurts the eyes
  • b

    brainy-ice-92385

    10/28/2022, 9:16 PM
    Oh I only considered the former, but the latter makes sense too! Preference?
  • s

    silly-soccer-20915

    10/28/2022, 9:20 PM
    in the current scenario I faced to make this workaround, it worked perfect as a "one shot hx-get" thing, and from what I understand htmx.config is sort of a global setting??
  • b

    brainy-ice-92385

    10/28/2022, 9:21 PM
    Correct. Could also consider another attribute that could be inheritable, like hx-swap-title
  • s

    silly-soccer-20915

    10/28/2022, 9:48 PM
    yup, agree that sounds reasonable
  • b

    brainy-ice-92385

    10/29/2022, 1:54 AM
    Hm I have 5 failures in the htmx test suite on dev branch. is that normal?
  • m

    mysterious-toddler-20573

    10/29/2022, 2:02 AM
    If you refresh a few times are they fixed?
  • m

    mysterious-toddler-20573

    10/29/2022, 2:03 AM
    I think a timing issue has crept in on chrome
  • m

    mysterious-toddler-20573

    10/29/2022, 2:03 AM
    And one is a focus issue. I’ll have them fixed for the release next week
  • b

    brainy-ice-92385

    10/29/2022, 2:05 AM
    oh huh ya. All but one:
    Copy code
    hx-trigger attribute
    reveal event works when triggered by window‣
    AssertionError: expected 'foo' to equal 'test 1'
        at Context.<anonymous> (attributes/hx-trigger.js:756:30)
  • m

    mysterious-toddler-20573

    10/29/2022, 2:26 AM
    Yep
  • m

    mysterious-toddler-20573

    10/29/2022, 2:26 AM
    That’s the focus one. I’ll have it cleaned up for the release.
  • b

    brainy-ice-92385

    10/29/2022, 3:03 AM
    @silly-soccer-20915 simpler than I thought to implement https://github.com/bigskysoftware/htmx/pull/1105
  • b

    bitter-machine-55943

    10/29/2022, 4:48 PM
    Is there any logical concept of a “page” or “page transition” in HTMX, as in sometimes you may be swapping out small parts of the same “page” like refreshing a status, while other times you’re doing a “page transition” like going from “home” to “contact us”? Or would this sort get captured in the updates to history, as in if you add to the page history (so the back button works), you could hook into some events there to detect “page transitions”?
  • g

    green-activity-6102

    10/29/2022, 4:56 PM
    when you're doing full-page replacements you can either do a partial swap of the entire
    <body>
    or use
    hx-boost
    to do it automatically for you (it's just swapping the body anyway).
    hx-boost
    will automatically push a new URL so your history will get updated, and if not using boost you can use
    hx-push-url
    to do the same
  • a

    astonishing-teacher-48635

    10/29/2022, 5:02 PM
    @mysterious-toddler-20573 One pattern I find myself having to reimplement over and over is: a better hx-prompt/hx-confirm Hx-prompt is a fantastic way to get quick user feedback, the UI the user sees just looks “not pretty” (default browser prompt) So I've been including hyperscript and wrapping it in sweetalert2. ie https://htmx.org/examples/confirm/ Unfortunately, this hides a bit of the behavior of the code (by pushing the logic to hyperscript/js, and removing of the hx-prompt key. I'm wondering if there is some official way to just have sweetalert2 replace hx-prompt entirely, perhaps via a plugin. Possibly this exists already I'm just not aware of it. Example current status: <button class="btn btn-sm p-0 m-0" hx-delete="/comment/{{ comment.id }}/" hx-trigger="confirmed" _="on click call Swal.fire({title: 'Confirm', text:'Are you sure you wish to delete this comment?', showCancelButton: true}) if result.isConfirmed trigger confirmed"> Example goal status (displays SWAL): <button class="btn btn-sm p-0 m-0" hx-delete="/comment/{{ comment.id }}/" hx-prompt="Are you sure you wish to delete this comment?">
  • b

    bitter-machine-55943

    10/29/2022, 5:29 PM
    Oh, I was thinking
    hx-boost
    replaced full
    <body>
    only. But can it do a subset? Like if I have sections for
    <body><header><main><footer>
    can I just swap
    <main>
    ?
  • g

    green-activity-6102

    10/29/2022, 5:30 PM
    You wouldn’t use boost for that. That’s just a regular htmx swap
  • a

    astonishing-teacher-48635

    10/29/2022, 5:55 PM
    @mysterious-toddler-20573 took a shot at writing this plugin. it seems the plugin supported events dont/wont hook soon enough to capture hx-prompt
1...880881882...1146Latest