Hyperscript behavior ceases to work after active search
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
Research direction
Start with the form's _="install CheckBoxDataGrid" behavior and the <tbody> replacement described in the issue, then reproduce the active-search swap. Verify that the checkbox click handler still fires and logs clicked checkbox after the replacement; the issue is resolved when the behavior continues working on the new rows.
Written by the indexing model from the issue text.
Description
I'm using hyperscript 0.9.14. I have a table of data in a form, with the first column in each row being a checkbox. There is a behavior defined in a .hs file and installed on the
tag. Users can filter the contents of the table through an active search feature. This is implemented in HTMX and it swaps the tag out for new HTML based on the results of the search. The issue is that the behavior reacts to events correctly on the page's first load, but ceases to work following a search.Is there a way to reassert a behavior following a change to a page's DOM?
<form hx-swap="none" _="install CheckBoxDataGrid">
<table>
<thead>
<tr>
<th>
My checkbox
</th>
</tr>
</thead>
<tbody id="key-aur-inf-res"> <!-- active search swaps this out -->
<tr>
<td>
<input type="checkbox" name="key-aur-mod-aauk-id" value="261">
</td>
</tr>
</tbody>
</table>
</form>
behavior CheckBoxDataGrid
on click from <input[name="key-aur-mod-aauk-id"] /> in me
log 'clicked checkbox'
end
end
I've put a video of this below. On the first page load, the "on click" event handler fires, and button's text on the bottom right corner of the screen changes when checkboxes are selected. However, following an active search the event handler doesn't fire and the text doesn't change.
https://github.com/user-attachments/assets/9be8ebd0-5913-41c2-acc5-cfa7e2f1978c
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bigskysoftware/_hyperscript
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bigskysoftware/_hyperscript#688 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bigskysoftware/_hyperscript#678 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
bigskysoftware/_hyperscript#676 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
bigskysoftware/_hyperscript#695 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
bigskysoftware/_hyperscript#687 ·
All issues in bigskysoftware/_hyperscript
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
PedestrianDynamics/pyFDS-Evac#476 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aiko-chan-ai/DiscordBotClient#380 ·
-
Offisielle trærOpen
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 3 days
-
Add: Atlas TVOpenchannels:add check:passed
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 4 days