Skip to content

htmx contract warning recommends hx-disinherit; the fix for self-inheritance is hx-select #235

@lbliii

Description

@lbliii

Problem

Inside a boosted shell (hx-boost + hx-target="#main" + hx-select="#page-content"), a local-swap form/fragment inherits hx-select="#page-content". Its own fragment response has no #page-content, so htmx selects nothing and swaps EMPTY — the element vanishes. app.check()'s htmx rule does warn (great), but it recommends hx-disinherit, which is the wrong lever: hx-disinherit controls what an element's descendants inherit, not what the element itself inherits. Adding it did nothing.

How it hurt (Lucky Cat #220)

The convert form silently vanished on submit. hx-disinherit="*" (per the warning) didn't fix it. The actual fix was overriding hx-select on the form (hx-select="#convert-form"). I nearly hit the same on the chart timeframe toggles.

Suggested fix

Correct the warning text + docs: for an element doing its own swap inside the boosted shell, override hx-select (and hx-target/hx-swap) on the element itself. Mention hx-disinherit only for the descendant case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium prioritycontractsapp.check() contract checkshypermediaCore hypermedia surface

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions