| 1 | --- |
| 2 | title: "htmx.config.defaultFocusScroll" |
| 3 | description: "Scroll to the focused element after a swap" |
| 4 | --- |
| 5 | |
| 6 | The `htmx.config.defaultFocusScroll` option, when set to `true`, causes htmx to scroll the focused element into view after each swap. |
| 7 | |
| 8 | **Default:** `false` |
| 9 | |
| 10 | ## Example |
| 11 | |
| 12 | ```javascript |
| 13 | htmx.config.defaultFocusScroll = true; |
| 14 | ``` |
| 15 | |
| 16 | ```html |
| 17 | <meta name="htmx-config" content='{"defaultFocusScroll":true}'> |
| 18 | ``` |
| 19 | |
| 20 | Useful when swapping content that moves focus to a new element and you want the user's view to follow. |
| 21 | |
| 22 | See also: [`htmx.config`](/reference/config/htmx-config) |