Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Handle dynamically added hx-disable #1567

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

Telroshan
Copy link
Collaborator

This fixes #1176
When dynamically adding hx-disable to an element from your custom code:

  • If any trigger handler is triggered on an element, it first checks if the element is currently disabled or not. If it is, cleans up the element (which removes all htmx listeners from it) & aborts the handler
  • You can also call htmx.process right after adding the attribute, to force the clean up immediately

When removing hx-disable from an element from your custom code:

  • You will have to explicitly call htmx.process to have htmx initialize that element and bind handlers again

Added test cases for hx-disable dynamic addition / removal

@alexpetros alexpetros added bug Something isn't working ready for review Issues that are ready to be considered for merging labels Jul 17, 2023
@alexpetros
Copy link
Collaborator

These tests are 👍👍

@1cg 1cg merged commit e89c9c6 into bigskysoftware:dev Jul 18, 2023
6 checks passed
@Telroshan Telroshan deleted the Fix-hx-disable-dynamically-added branch September 22, 2023 05:40
@feakuru feakuru mentioned this pull request Dec 15, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready for review Issues that are ready to be considered for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants