Skip to content

fix hx-live chaining with next and previous - #4079

Merged
1cg merged 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:hx-live-chain
Sep 17, 2026
Merged

1cg merged 1 commit into
bigskysoftware:four-devfrom
MichaelWest22:hx-live-chain

Conversation

@MichaelWest22

@MichaelWest22 MichaelWest22 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Description

When chaining .q(), next and previous navigate between siblings, so they need to search within the parent element to find elements that come before or after the current one. But first, last, and plain CSS selectors are looking for descendants, so they should scope their search inside each matched element. The fix uses e.parentElement as the search root for next/previous and e for everything else, giving each directive the natural scope it needs.

Corresponding issue:
#4077

Testing

Added tests

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@MichaelWest22 MichaelWest22 added the htmx 4 Issues specific to htmx version 4 label Sep 16, 2026
@1cg
1cg merged commit 75b2a8f into bigskysoftware:four-dev Sep 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

htmx 4 Issues specific to htmx version 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants