bigskysoftware / bigskysoftware/htmx

hx-disabled-elt should keep elements disabled until after the DOM has settled

Open
#3,363 0 comments 5 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,

Currently `hx-disabled-elt` keeps elements disabled only until the response arrives, which could happen noticeably sooner than swapping and settling.

There is a workaround, but that only works if all disabled elements are *unconditionally* removed from the DOM at the end of the request (for example with `hx-swap="delete swap:1s"`), because with it, the `disabled` attribute will never be removed from elements: `hx-on::before-on-load="event.detail.keepIndicators=true"`. Also, this workaround uses undocumented behavior as far as I can tell.

There would be an additional benefit of changing the existing behavior. It's not good UX to disable or change the visible content multiple times very rapidly, but currently the disabled state is removed immediately when the response arrives, and then the DOM is updated a little bit later, causing at least one "flash". Disabling elements until after the DOM has settled would result in better UX.

I know this could be considered a breaking change, but the documentation is not that exact here, and the change wouldn't be perceptible for standard use-cases as far as I can tell, although I'm sure the maintainers have much deeper knowledge on this.

For reference, here is the [link](https://discord.com/channels/725789699527933952/1390302543002992691) to the original Discord discussion.

Thanks!

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.