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-boost scroll to default (feature request) #3138

Open
onno-timmerman opened this issue Jan 17, 2025 · 1 comment
Open

hx-boost scroll to default (feature request) #3138

onno-timmerman opened this issue Jan 17, 2025 · 1 comment

Comments

@onno-timmerman
Copy link

I think the behaviour of hx-boost scroll to is not user friendly (unless I miss something). When you have, for example a menu, and use hx-boost. When something below the menu is replaced then whenever you use hx-boost it will jump to the div but your menu will not be in the screen anymore. Only can mitigate this by adding a # to the url or using one of the settings.
I think it would be better not to have this scroll functionality by default False on hx-boost and to turn it on explicit or have hx-scroll attr that you can set on particular hx-boost.

We also have to help:
htmx.config.defaultFocusScroll
htmx.config.scrollBehavior

@Telroshan
Copy link
Collaborator

I think it would be better not to have this scroll functionality by default

That would be a debatable matter, unfortunately we can't change defaults at this would be a breaking change for existing htmx-powered apps.

If you don't like this scrolling behavior, note that you can turn htmx.config.scrollIntoViewOnBoost to false.
Note that you can also specify element-specific scrolling behaviors using the scroll/show modifiers of hx-swap

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants