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

HX-Reselect does not support "unset" (like hx-select does) #3152

Open
oliverhaas opened this issue Jan 28, 2025 · 0 comments · May be fixed by #3153
Open

HX-Reselect does not support "unset" (like hx-select does) #3152

oliverhaas opened this issue Jan 28, 2025 · 0 comments · May be fixed by #3153
Labels
enhancement New feature or request

Comments

@oliverhaas
Copy link

oliverhaas commented Jan 28, 2025

Pretty much the title.

HX-Reselect does not support unset like hx-select does.

I guess this is a pretty rare case, but I wanted to basically do the following:

<button hx-select="#some_div" hx-target="#some_div">
  Click me
</button>

Then on the server side I want to switch to a body swap, and since hx-select is set I need to unset it.

HX-Retarget = "body"
HX-Reselect = "unset"

Such a body swap might be the only case where unset really matters, since otherwise one is probably able to just work with css selectors. In this case I don't think there is a way. Yes, I've tried :scope, :host, *, > *, and all other suggestions for the selector I could find. maybe I'm missing something...

But in any case: I think it would be nice if htmx would just support the HX-Reselect override with unset like one would expect.

@oliverhaas oliverhaas linked a pull request Jan 28, 2025 that will close this issue
4 tasks
@oliverhaas oliverhaas changed the title HX-Reselect does not support "unset" HX-Reselect does not support "unset" (like hx-select does) Jan 28, 2025
@Telroshan Telroshan linked a pull request Jan 29, 2025 that will close this issue
4 tasks
@Telroshan Telroshan added the enhancement New feature or request label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants