Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/router/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export default Blits.Component('Poster', {

Whenever you navigate to a new page, the URL hash will automatically be updated. Unless specified otherwise, navigating to a new page, will add that route to the history stack. The `back` input action is automatically wired up to navigate back down the history stack.

By default, every time you navigate to a new route, the application focus will be automatically passed to the newly loaded page. If you instead want to maintain the current focus (for example in a widget that sits above your RouterView), you can use `passFocus: false` as part of the router options.

## Deeplinking

The Router plugin has support for deeplinking. When the App is loaded with a URL hash (i.e. `#/pages/settings/network`), the router will try to match that hash to a defined route. This means that your app can be deep linked into, by simply providing the correct URL hash.
Expand Down
6 changes: 4 additions & 2 deletions src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,10 @@ export const navigate = async function () {
// keep reference to the previous focus for storing in cache
previousFocus = Focus.get()

// set focus to the view that we're routing to
focus ? focus.$focus() : /** @type {BlitsComponent} */ (view).$focus()
// set focus to the view that we're routing to (unless explicitly disabling passing focus)
if (route.options.passFocus !== false) {
focus ? focus.$focus() : /** @type {BlitsComponent} */ (view).$focus()
}

// apply before settings to holder element
if (route.transition.before) {
Expand Down