bigskysoftware / bigskysoftware/htmx
`hx-trigger="my-event from:closest some-parent"` is broken in 4.0
- Dominant language
- JavaScript
- Stars
- 49.4k
- Forks
- 1.7k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 30
Description
Showcase:
Expected: all buttons should result in making a request to `/doesnotmatter`.
Actual: only the first button works as expected.
This used to work in htmx 2.0.
```html
Test
Trigger from child
Trigger from parent
Trigger from parent but outside
```
Run this Python one-liner to serve files in current folder with `hx-trigger: testevent` at http://localhost:8001
`python3 -c $'import http.server, socketserver\nclass H(http.server.SimpleHTTPRequestHandler):\n def send_response(self, code, message=None):\n self._status_code = code\n super().send_response(code, message)\n def end_headers(self):\n if 200 <= getattr(self, "_status_code", 0) < 300:\n self.send_header("HX-Trigger", "testevent")\n super().end_headers()\nsocketserver.TCPServer(("", 8001), H).serve_forever()'`
Contributor guide
Research direction
Run the supplied HTML showcase with the Python server and compare the first child trigger with the `from:closest article` cases. Start at htmx's `hx-trigger` event handling for `from:closest`, using the htmx 2.0 behavior as a comparison point. Done means every button makes a request to `/doesnotmatter`, including the button outside the inner div.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100