bigskysoftware / bigskysoftware/htmx

on Chrome, htmx-swap via <button> scrolls to bottom of page if any <select> is present

Open
#3,340 5 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

The details in the issue title seem strangely specific, but I currently can't reproduce this issue unless all of these conditions are present.

Here's my html file:

```html






dummy


1


2


3


4


5





```

the `scrolltestsub.html` simply contains the same content as in `foo`. reproduced below for convenience:

```html

1


2


3


4


5



```

If the browser is scrolled to the top of the page, clicking a button keeps the page in the same location, as I would have expected, since the resulting content is the same.

If you scroll down a little bit (say, scroll down so that the 1 button isn't visible but the 2 button is), then click one of the buttons, the page then scrolls down all the way to the bottom of the page, which is unexpected and inconvenient in a setting where I want to allow the buttons to be clicked one after the other without having to scroll back up in between clicks.

This happens in Chrome 137.0.7151.103, but not in Firefox.
It doesn't happen if you delete the `select`.
It also doesn't happen if you change the `button` to an `a`.

I'm having a tough time figuring out whether the cause is something in HTMX or something in Chrome. Do you have any insight as to what might be going on here?

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.