bigskysoftware / bigskysoftware/htmx
[4.0.0-beta6] htmx.trigger('#id','htmx:abort') works only for requests made using hx-* attribute
- Dominant language
- JavaScript
- Stars
- 49.4k
- Forks
- 1.7k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 30
Description
I tried 4.0.0-beta6 on a small hobby project I'm developing and soon end up with issues while trying to abort a request. Turns out that htmx.trigger('#id','htmx:abort') does not work if the reguest was made from javascript and not directly from a attribute hx-get,hx-post... attribute.
Below is a PHP/html example that shows the problem.
* update, keep the developer tools network tab open to see the issue.
```
----- /abort/sleep30s.php-----
-----/abort/htmx.html-----
Click Me
abort works on v2 & v4
Click Me
abort works on v2 not v4
```
Contributor guide
Research direction
Start with the htmx.ajax call and the htmx:abort trigger in the provided htmx.html reproduction, using sleep30s.php to keep the request open while watching the network tab. Compare the JavaScript-initiated request with the hx-post request and verify that triggering htmx:abort cancels both in htmx 4.0.0-beta6.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100