bigskysoftware / bigskysoftware/htmx

hx-disabled-elt causes unhandled exception when targets not found

Open
#2,913 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

Hi there,

Following along with the example of settings for `hx-disabled-elt`, and taking advantage of the inheritance, when the elements specified in the `hx-disabled-elt` are not found htmx fails with `Uncaught TypeError: Cannot read properties of null (reading 'htmx-internal-data')`.

After a fair bit of debugging, the issue comes from a setup like this:
```




Submit

Do something

```

In the above example, the elements in the form are disabled and work great, when when the second link it pressed, because there are no child elements of `input` or `button` for find to work on, the uncaught exception is generated.

When the elements specified in a `hx-disabled-elt` are not found (or not children exist) the failure should be more graceful, especially since as an inheritable property it may be used in a number of different circumstances.

This is occurring with htmx 2.0.2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.