bigskysoftware / bigskysoftware/_hyperscript

Hyperscript behavior ceases to work after active search

Aperta
#638 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
3.8k
Fork
171
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

```html





My checkbox










```
```hyperscript
behavior CheckBoxDataGrid
on click from 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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia con il comportamento del form per `_="install CheckBoxDataGrid"` e con la sostituzione di `` descritta nell’issue, quindi riproduci lo scambio della ricerca attiva. Verifica che il gestore del clic della casella di controllo continui a essere attivato e registri `clicked checkbox` dopo la sostituzione; l’issue è risolta quando il comportamento continua a funzionare sulle nuove righe.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
frontend, web-dev
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.