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

    early-camera-41285

    09/25/2022, 7:14 PM
    Yeah... I figured I'd just always wait long enough to cover all but the slowest network speeds, but now that feels like an antipattern. I'll retract this question. Really, the swapped content needs to control the end of an animation
  • m

    mysterious-toddler-20573

    09/25/2022, 8:53 PM
    OK, keep thinking on it though
  • m

    mysterious-toddler-20573

    09/25/2022, 8:53 PM
    if there is a good pattern here I want to satisfy it
  • m

    mysterious-toddler-20573

    09/25/2022, 8:53 PM
    idiomorph, spotted in the wild: https://twitter.com/paulweveritt/status/1574137904221274112
  • f

    future-table-82610

    09/26/2022, 12:54 AM
    Has anyone found a way around hx-preserve causing an active input to loose focus?
  • c

    cuddly-keyboard-70746

    09/26/2022, 5:37 AM
    if nothing else there is youtrack
  • c

    cuddly-keyboard-70746

    09/26/2022, 5:38 AM
    https://youtrack.jetbrains.com/issues/IDEA
  • m

    mysterious-toddler-20573

    09/26/2022, 1:10 PM
    can you explain what you mean?
  • s

    silly-soccer-20915

    09/26/2022, 5:51 PM
    hey crew! I want to trigger change only on a few child input elements on a form AND on form submit, and trying with hx-trigger set on the :
    Copy code
    hx-trigger="change from: find input[type=checkbox], submit"
    am i on the right direction?? getting a syntax error lol
  • s

    silly-soccer-20915

    09/26/2022, 5:55 PM
    oh! the space
  • s

    silly-soccer-20915

    09/26/2022, 5:57 PM
    Fixed version:
    Copy code
    hx-trigger="change from:find input[type=checkbox], submit"
  • s

    silly-soccer-20915

    09/26/2022, 6:00 PM
    but now htmx doesn't make the request , strange
  • f

    future-table-82610

    09/27/2022, 12:50 AM
    Apologies, I realized my question lacked context. When updating a page in the background, if a form field has
    hx-preserve
    set, the field won't be replaced - however, if it currently has focus when the background update happens, the input element loses focus. For example, I have a page where a user could be typing away and when the page refreshes, the
    hx-preserve
    correctly leaves their entered text, but if they aren't paying attention whatever they are currently typing gets lost (since there is no element with focus). It just causes a lot of user annoyance, and sometimes page jumping (ie if they hit the space bar).
  • h

    hundreds-camera-24900

    09/27/2022, 1:43 AM
    I am swapping in a component that has an alpine div with x-init="new CreateWidgetThatChangesDom" and I'm seeing the init call happen so fast that it's fighting with the swap
  • h

    hundreds-camera-24900

    09/27/2022, 1:45 AM
    I need to add a settimeout with like 40ms to get it happening after the swap reliably
  • m

    mysterious-toddler-20573

    09/27/2022, 2:10 AM
    hmm, it seems like it should work. We try to preserve focus by ID. Does the element have an id on it?
  • m

    mysterious-toddler-20573

    09/27/2022, 2:10 AM
    there might be a bad interaction between
    hx-preserve
    and our focus code
  • m

    mysterious-toddler-20573

    09/27/2022, 2:11 AM
    can you give a bit more info here? What's the sequence of events in the bad case?
  • h

    hundreds-camera-24900

    09/27/2022, 2:13 AM
    it's hard to give more info because I can't catch it in the act
  • h

    hundreds-camera-24900

    09/27/2022, 2:13 AM
    but the bad case is click button -> new html comes in -> classes that the library should be setting up are on the wrong spot
  • m

    mysterious-toddler-20573

    09/27/2022, 2:13 AM
    😑
  • h

    hundreds-camera-24900

    09/27/2022, 2:13 AM
    yeah
  • m

    mysterious-toddler-20573

    09/27/2022, 2:14 AM
    seems like we need an event to sync the
    init
    w/ the new content?
  • h

    hundreds-camera-24900

    09/27/2022, 2:14 AM
    My theory is that alpine is picking up the change to the dom and reacting before htmx has given the all clear
  • h

    hundreds-camera-24900

    09/27/2022, 2:15 AM
    can I nest morph styles? I can't right
  • h

    hundreds-camera-24900

    09/27/2022, 2:15 AM
    I can't say EG this one element is an alpine morph but everything else is a normal swap
  • h

    hundreds-camera-24900

    09/27/2022, 2:16 AM
    that's silly I don't really want to preserve the alpine element I just want to pause it
  • h

    hundreds-camera-24900

    09/27/2022, 2:16 AM
    I wonder if there's a global start change/stop change
  • m

    mysterious-toddler-20573

    09/27/2022, 2:16 AM
    my lack of alpine-fu is showing
  • h

    hundreds-camera-24900

    09/27/2022, 2:16 AM
    yeah ditto 😦
1...837838839...1146Latest