mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
a687383440
@ -103,11 +103,19 @@ You may also use `window:top` and `window:bottom` to scroll to the top and botto
|
|||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, htmx attempts to preserve focus between requests. This will cause the focused element to scroll into view
|
#### <a name="focus-scroll"></a>Focus scroll
|
||||||
which can be unwanted behavior in some cases. To disable this, you can use `focus-scroll:false`:
|
|
||||||
|
htmx preserves focus between requests for inputs that have a defined id attribute. By default htmx prevents auto-scrolling to focused inputs between requests which can be unwanted behavior on longer requests when the user has already scrolled away. To enable focus scroll you can use `focus-scroll:true`.
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<input hx-get="/validation"
|
<input id="name" hx-get="/validation"
|
||||||
|
hx-swap="outerHTML focus-scroll:true"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, if you want the page to automatically scroll to the focused element after each request you can change the htmx global configuration value `htxm.config.defaultFocusScroll` to true. Then disable it for specific requests using `focus-scroll:false`.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<input id="name" hx-get="/validation"
|
||||||
hx-swap="outerHTML focus-scroll:false"/>
|
hx-swap="outerHTML focus-scroll:false"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1304,7 +1304,7 @@ listed below:
|
|||||||
| `htmx.config.wsReconnectDelay` | defaults to `full-jitter`
|
| `htmx.config.wsReconnectDelay` | defaults to `full-jitter`
|
||||||
| `htmx.config.disableSelector` | defaults to `[disable-htmx], [data-disable-htmx]`, htmx will not process elements with this attribute on it or a parent
|
| `htmx.config.disableSelector` | defaults to `[disable-htmx], [data-disable-htmx]`, htmx will not process elements with this attribute on it or a parent
|
||||||
| `htmx.config.timeout` | defaults to 0 in milliseconds
|
| `htmx.config.timeout` | defaults to 0 in milliseconds
|
||||||
| `htmx.config.defaultFocusScroll` | if the focused element should be scrolled into view, defaults to false
|
| `htmx.config.defaultFocusScroll` | if the focused element should be scrolled into view, defaults to false and can be overriden using the [focus-scroll](/attributes/hx-swap/#focus-scroll) swap modifier.
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user