htmx icon indicating copy to clipboard operation
htmx copied to clipboard

hx-disabled-elt problem with hx-trigger="load"

Open bearpreis opened this issue 1 year ago • 1 comments

As of htmx version 2.0.0 the behaviour of hx-disabled-elt in combination with hx-trigger=“load” is broken. The disabled attribute is not removed after the request.

Expected behaviour would be that the element is only disabled while the htmx request is running.

Example (will work, if loading version 1.9.9):

<html>
    <head>
        <script src="https://unpkg.com/[email protected]"></script>
    </head>
    <body>
        <span hx-post="/foo" hx-disabled-elt="#submit" hx-trigger="load">test</span>
        <button type="submit" id="submit">Save</button>
    </body>
</html>

Our current workaround is using intersect instead of load in these cases.

bearpreis avatar Jul 29 '24 09:07 bearpreis

Hey, just fiddled with your example above and it looks like this bug was introduced in htmx 1.9.10, as it works with 1.9.9 but with 1.9.10, has the same issue than with htmx 2. We would have to dive in the commits to find where/when this was introduced, and why. If you feel like investigating, a bugfix PR is welcome! Otherwise, I'll try to find time in the upcoming days to look into this

Telroshan avatar Jul 29 '24 13:07 Telroshan