imacrayon / alpine-ajax

An Alpine.js plugin for building server-powered frontends.
https://alpine-ajax.js.org
MIT License
558 stars 11 forks source link

x-target response modifiers & aria-busy #82

Closed paul2569 closed 2 months ago

paul2569 commented 2 months ago

Hi,

I was trying out the x-target response modifiers and it doesn't seem to remove the aria-busy="true" from the source element on an error response.

The request completes, "form_err" div is populated with received html but the form element still has the aria-busy attribute left on it resulting in a stuck loading spinner (I'm using css similar to loading example for displaying a spinner on aria-busy).

Thanks.

Original HTML

<div id="form_err"></div>
<form
    id="step1_form"
    method="POST"
    action="/my-url"
    x-init
    x-target
    x-target.302="_self"
    x-target.error="form_err"
>
    <input
        type="text"
        name="name"
    >
    <button
        id=""
        type="submit"
    >
        Submit
    </button>
</form>

Server Response, statusCode: 400

<div id="form_err">an error message</div>
imacrayon commented 2 months ago

Hey, thanks for reporting this, I just released v0.7.1 which should fix the issue.

paul2569 commented 2 months ago

Great thanks it's working now.